This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var immer = require("immer"); | |
var produce = immer.produce; | |
var patches = []; | |
var state0 = { a: 1 }; | |
var state1 = produce( | |
state0, | |
function (draft) { | |
draft.b = 9; | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func decorator(f func(s string)) func(s string) { | |
return func(s string) { | |
fmt.Println("Started") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
users if active or not on a given day plus counts of events | |
""" | |
import os | |
import csv | |
from collections import defaultdict | |
from collections import Counter | |
UFILE = 'data/users.csv' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is modifed from https://gist.github.com/caiguanhao/4528926 | |
# This is an improved script of pngfix.sh (https://gist.github.com/404909) | |
# which can also crush/shrink/optimize/losslessly compress JPEGs and GIFs. | |
# It is recommended you backup your image files before executing this script. | |
# Operation will be skipped if output file is bigger in size. | |
# | |
# use chmod +x crushimg.sh to make it executable and then ./crushimg.sh to run, or | |
# bash ./crushimg.sh to run it directly | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vm = require('vm'), | |
Contextify = require('contextify'), | |
code = 'var square = n * n;', | |
fn = new Function('n', code), | |
script = vm.createScript(code); | |
n = 5; | |
benchmark = function(title, funk) { | |
var end, i, start, spins = 10000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install git | |
sudo apt-get install g++ curl libssl-dev apache2-utils | |
sudo apt-get install git-core | |
sudo apt-get install nodejs | |
# install the Node package manager for later use | |
curl http://npmjs.org/install.sh | sudo sh | |
sudo npm install express | |
# clone the statsd project | |
git clone https://github.com/etsy/statsd.git | |
# download everything for graphite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initRules: () -> | |
# Rules are children of reads. Setup the @rules collection, set a URL on the collection. | |
# then fetch all the children from the api | |
@rules = new Rules({}) | |
@rules.urlRoot = "#{@url()}/rules" |