/** 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); |
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}`); |
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 |
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) |
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!
\
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); |
/** | |
* 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)', |
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