Skip to content

Instantly share code, notes, and snippets.

@yocontra
yocontra / EventEmitter.coffee
Created May 20, 2012 19:57
Tiny browser/node EventEmitter implementation in coffeescript
class EventEmitter
constructor: ->
@events = {}
emit: (event, args...) ->
return false unless @events[event]
listener args... for listener in @events[event]
return true
addListener: (event, listener) ->
@puffnfresh
puffnfresh / covariant.ts
Created October 1, 2012 17:06
Covariant arrays. Blurgh.
// Compiles fine even though the code is broken.
// This is because arrays are covariant and mutable.
//
// TypeScript team: Please fix either of those things. Preferably mutability :)
class Animal {}
class Snake extends Animal {
slither() {
alert("Slithering!")
@kapkaev
kapkaev / gist:4619127
Created January 24, 2013 09:30
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. Resque
$ redis-cli
> config set stop-writes-on-bgsave-error no
@michaelhollman
michaelhollman / nest-test.js
Last active September 3, 2020 07:20
The woes of CasperJS nesting
//nesting thens
casper.then(function () {
this.log('THEN #1', 'info', 'then');
this.then(function () {
this.log('THEN #2', 'info', 'then');
this.then(function () {
this.log('THEN #3', 'info', 'then');
});
this.log('THEN #4', 'info', 'then');
@reem
reem / saga.js
Created October 28, 2016 08:45
function runSaga(saga, ...args) {
const generator = saga(...args);
return execute(generator, []);
}
function* values(arr) {
for (let i = 0; i < arr.length; i++) {
yield arr[i];
}
}
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active July 31, 2024 18:47
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@L3viathan
L3viathan / README.md
Created December 15, 2017 20:08
Underhanded Python

Underhanded Python

To test:

>>> from underhanded import login
>>> login("l3viathan", "12345678")
0