Skip to content

Instantly share code, notes, and snippets.

View sorahn's full-sized avatar
🎩

Daryl Roberts sorahn

🎩
  • Tovia, LLC
  • Atlanta
View GitHub Profile
const {useCallback, useEffect, useReducer, useRef} = require('react');
let effectCapture = null;
exports.useReducerWithEmitEffect = function(reducer, initialArg, init) {
let updateCounter = useRef(0);
let wrappedReducer = useCallback(function(oldWrappedState, action) {
effectCapture = [];
try {
let newState = reducer(oldWrappedState.state, action.action);
@sorahn
sorahn / Laws of Computer Programming.md
Last active September 15, 2023 17:54
COMPUTER© 1980 ART 101 Limited, Atlanta Georgia - Kenneth Grooms

laws of computer programming

  • any given program, when running, is obsolete.
  • if a program is useless, it will have to be documented.
  • if a program is useful, it will have to be changed.
  • any program will expand to fill all available memory.
  • the value of a program is proportional to the weight of its output.
  • program complexity grows until it exceeds the capability of the programmer to maintain it.
  • make it possible for programmers to write in english and you will find that programmers cannot write in english.

rules of pratt

@algesten
algesten / start-tmux.sh
Created May 14, 2017 07:59
start tmux in bashrc
# TMUX
# test if tmux is available
if type tmux >/dev/null 2>&1; then
# if not inside a tmux session, and if no session is started, start a new session
# I only want this on my mac laptop.
if [ -z "$TMUX" -a `uname` == Darwin ]; then
# attach to session "martin" if there
exec tmux -2 -f ~/.tmux-osx.conf new-session -A -s martin
fi
fi
@lydell
lydell / .eslintrc.js
Last active September 22, 2017 09:29
Generates .flowconfig regexps that ignores everything in `node_modules/` except the given modules.
module.exports = {
extends: [
"strict",
"prettier",
],
parserOptions: {
ecmaVersion: 2016,
},
plugins: ["prettier"],
rules: {
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@jdennes
jdennes / README.md
Last active January 6, 2024 01:46
Convert a directory of .ogg files to .mp3 files
  • You need ffmpeg installed. If you have Homebrew installed on a Mac, you can do this by running:

    brew install ffmpeg
    
  • Put process.sh in directory containing .ogg files.

  • Ensure it's executable:

@paulirish
paulirish / what-forces-layout.md
Last active April 19, 2024 06:03
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
import React from 'react';
import { TransitionSpring, presets } from 'react-motion';
export default class Modal {
static propTypes = {
shown: React.PropTypes.bool,
onClose: React.PropTypes.func
};
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}