Skip to content

Instantly share code, notes, and snippets.

View dadwic's full-sized avatar
👨‍💻
Freelancing

Mehrdad Mehralian dadwic

👨‍💻
Freelancing
View GitHub Profile
@balazsorban44
balazsorban44 / apple-gen-secret.mjs
Last active August 14, 2025 21:08
Script to generate Apple Client secret
// This is now built into `npx auth add apple`! :tada:
// https://github.com/nextauthjs/cli/pull/10
#!/bin/node
import { SignJWT } from "jose"
import { createPrivateKey } from "crypto"
if (process.argv.includes("--help") || process.argv.includes("-h")) {
@pbeshai
pbeshai / Controls.js
Created June 8, 2020 15:18
Example controls for react-three-fiber with animating camera
import TWEEN from '@tweenjs/tween.js';
import React, { useEffect, useRef } from 'react';
import { extend, useFrame, useThree } from 'react-three-fiber';
import * as THREE from 'three';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
// extend THREE to include OrbitControls
extend({ OrbitControls });
@jauyeunggithub
jauyeunggithub / App.js
Created May 9, 2020 20:47
StylesProvider
import React from "react";
import { StylesProvider } from "@material-ui/core/styles";
import Button from "@material-ui/core/Button";
import "./styles.css";
export default function App() {
return (
<StylesProvider injectFirst>
<div className="App">
<Button>Hook</Button>
@vtenq
vtenq / git-workflow.md
Last active January 20, 2025 12:19
Git workflow with conventional commits and semantic auto release

Git workflow with conventional commits and semantic auto release

This is an adoptation of Git flow by Vincent Driessen with conventional commits and semantic release.

The main concepts

At the core, the development model is greatly inspired by existing models out there. The central repo holds two main branches with an infinite lifetime:

@thomasgroch
thomasgroch / x11_f0rwarding.sh
Created June 26, 2019 18:03
X11 Forwarding (to connect from macOS to Debian Linux)
# Connect from macOS to remote Linux server. For example to Debian or Ubuntu.
# Prepare remote server.
# Enable X11 Forwarding in SSH.
vim /etc/ssh/sshd_config
#X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost no
systemctl restart sshd
@fengyuentau
fengyuentau / readme.md
Last active January 4, 2026 17:29
Enable X11 forward for ssh to load images from remote server on MacOS Mojave

Enable X11 forward to load images from remote server on MacOS Mojave

Steps

  1. Install Xquartz to get X11 support on MacOS. You can google Xquartz and download it from its official site, or install using HomeBrew.

    brew cask install xquartz
  2. Launch Xquartz. Go to Preference -> Security, click the box Allow connections from clients. NOTE: You have to lauch Xquartz with Allow connections from clients enable everytime you want to ssh to remote server with X11 forwarding support.

@mauricedb
mauricedb / Subject under test
Last active December 7, 2023 14:46
Testing stateful React hooks
import { useState } from 'react';
export function useCounter(initial = 0) {
const [count, setCount] = useState(initial);
return [count, () => setCount(count + 1)];
}
@hubgit
hubgit / SelectField.tsx
Last active March 31, 2025 22:59
Use react-select with Formik
import { FieldProps } from 'formik'
import React from 'react'
import Select, { Option, ReactSelectProps } from 'react-select'
export const SelectField: React.SFC<ReactSelectProps & FieldProps> = ({
options,
field,
form,
}) => (
<Select

If .DS_Store was never added to your git repository, simply add it to your .gitignore file.

If you don't have one, create a file called

.gitignore

In your the root directory of your app and simply write

@mykeels
mykeels / README.md
Last active October 1, 2018 00:59
Kill Apache Service on Mac - bind() to 0.0.0.0:80 failed (48: Address already in use)

To find out the program interfering with port 80 on Mac,

sudo lsof -i:80

If it's httpd it's the Apache Service, so use the command in kill-apache.sh in your terminal to shut it down, then valet restart

If you get a 404, try valet link in your app directory.