Skip to content

Instantly share code, notes, and snippets.

View jadnco's full-sized avatar

Jaden Dessureault jadnco

View GitHub Profile
@developit
developit / preact-unrecycle.js
Last active January 28, 2019 04:27
preact-unrecycle.js
/** Usage:
* const MyView = unrecycle(props => {
* // this is normally a no-go and creates leaking styles, but it won't with unrecycle():
* <input ref={ c => c && c.style.background='red' } />
* })
*/
export default function unrecycle(Component) {
return function Unrecycle(props, context) {
this.componentWillUnmount = dontRecycle;
return Component.call(this, props, context);
@swalkinshaw
swalkinshaw / tutorial.md
Last active February 26, 2025 21:15
Designing a GraphQL API
@developit
developit / * Preact Compat "Lite".md
Last active September 22, 2022 15:44
a lot of libs can roll with this tiny shim.

Usage:

In your webpack config:

resolve: {
  alias: {
    'react': 'preact-compat-lite',
    'react-dom': 'preact-compat-lite'
 }
function t(strings, ...values) {
const string = strings.reduce((s, next, i) => `${s}%{${i}}${next}`);
return new IntlMessageFormat(string, 'en-us').format(values);
}
const person = 'Mike';
const age = 28;
console.log(t`${person} is age ${age}`);
@danibram
danibram / iptables.sh
Created February 3, 2016 12:03
Redirect 443,80 to 8443,8080 on ubuntu with persistence
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8443
sudo sh -c "iptables-save > /etc/iptables.rules"
sudo apt-get install iptables-persistent
@psobot
psobot / bouncer.py
Last active October 22, 2024 01:22
Logic Pro X Project Bounce script
import os
import sys
import time
import atomac
import subprocess
if len(sys.argv) < 2:
print "Usage: bouncer.py <path_to_logic_project> (<path_to_logic_project>)"
os.exit(1)
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 11, 2025 17:09
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@mdodsworth
mdodsworth / gist:3490042
Created August 27, 2012 16:23
node: multicast example
var dgram = require('dgram');
var socket = dgram.createSocket('udp4');
var testMessage = "[hello world] pid: " + process.pid;
var multicastAddress = '239.1.2.3';
var multicastPort = 5554;
socket.bind(multicastPort, '0.0.0.0');
socket.addMembership(multicastAddress);
@shodanuk
shodanuk / transitionCss.js
Created March 18, 2012 10:35
Generate cross browser transitons CSS (includes custom easing functions)
/**
* Create cross browser transition CSS
*
* @param {Integer} duration Duration in milliseconds.
* @param {String} easing Easing function. Can be built-in CSS3 function or one of the provided custom functions.
* @param {String} prop CSS property to apply transition to.
*/
function transitionCss(duration, easing, prop) {
var easingDefs = {
easeInCubic : 'cubic-bezier(0.550, 0.055, 0.675, 0.190)',
@isaacsanders
isaacsanders / Equity.md
Created January 21, 2012 15:32
Joel Spolsky on Equity for Startups

This is a post by Joel Spolsky. The original post is linked at the bottom.

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju