View remove_merged_branches.rb
for b in `git branch --merged | grep -v \*`; do git branch -D $b; done
View start-all.sh
#! /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
View queue.js
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() {
View extended_csv.rb
require 'csv'
class ExtendedCSV
attr_accessor :filepaths
def initialize filepaths
@filepaths = [*filepaths]
end
def + other_extended_csv
View Common-Currency.json
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
View draw-tree.py
import cairo
from contextlib import contextmanager
@contextmanager
def saved(cr):
cr.save()
try:
yield cr
finally:
cr.restore()
View body.html
<html>
<head>
<script type="text/javascript" src="curry.js" />
<title>currying in javascript</title>
</head>
<body>
<div id="item">default</div>
</body>
</html>
View bak.sh
# quick and easy backuping
# put int ~/src/bak
cp -r "$1" "$1.bak"
View foreman.rb
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 }