This file contains hidden or 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
for b in `git branch --merged | grep -v \*`; do git branch -D $b; done |
This file contains hidden or 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 | |
# Starts up Hadoop dfs + mapred | |
# can specify config by passing in an optional parameter: | |
# | |
# $ ./start-all.sh | |
# $ ./start-all.sh path-to-config | |
# | |
# If optional parameter is not supplied, it will default to | |
# $HADOOP_INSTALL/conf |
This file contains hidden or 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
function Queue(config) { | |
this.throttle = (typeof config['throttle'] !== "undefined") ? config['throttle'] : 2000; | |
this.elements = config['elements']; | |
this.operation = config['operation']; | |
this.interval_id = null; | |
return this; | |
} | |
Queue.prototype.process = function() { |
This file contains hidden or 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
require 'csv' | |
class ExtendedCSV | |
attr_accessor :filepaths | |
def initialize filepaths | |
@filepaths = [*filepaths] | |
end | |
def + other_extended_csv |
This file contains hidden or 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
{ | |
"USD": { | |
"symbol": "$", | |
"name": "US Dollar", | |
"symbol_native": "$", | |
"decimal_digits": 2, | |
"rounding": 0, | |
"code": "USD", | |
"name_plural": "US dollars" | |
}, |
This file contains hidden or 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
import cairo | |
from contextlib import contextmanager | |
@contextmanager | |
def saved(cr): | |
cr.save() | |
try: | |
yield cr | |
finally: | |
cr.restore() |
This file contains hidden or 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
<html> | |
<head> | |
<script type="text/javascript" src="curry.js" /> | |
<title>currying in javascript</title> | |
</head> | |
<body> | |
<div id="item">default</div> | |
</body> | |
</html> |
This file contains hidden or 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
# quick and easy backuping | |
# put int ~/src/bak | |
cp -r "$1" "$1.bak" |
This file contains hidden or 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
class Foreman | |
attr_accessor :units_of_work, :workers_count | |
def initialize attrs = {} | |
@units_of_work = attrs[:units_of_work] | |
@workers_count = attrs[:workers_count] | |
end | |
def fair_shares | |
even_shares = Array.new(@workers_count) { @units_of_work / @workers_count } |