Skip to content
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 }
View forking_and_waiting.rb
pids = []
[0, 1, 2].each do |i|
pids << fork do
sleep 5 - i
puts "Hi from #{i}\n"
end
end
puts "done forking" # note: if you >> this file to another file, you will need $stdout.flush to ensure proper write ordering
pids.each { |pid| Process.wait pid }
View git_mv_a_bunch_of_files.sh
for f in `ls ./*.png`; do git mv $f $(echo $f | sed s/control/ctrl/); done
Something went wrong with that request. Please try again.