Skip to content

Instantly share code, notes, and snippets.

View amitkrishna's full-sized avatar
🍁
Eye of the Tiger

Amit Krishna amitkrishna

🍁
Eye of the Tiger
View GitHub Profile
@dblock
dblock / getWeek.js
Created July 13, 2011 22:49
get week of the year in JavaScript
function( d ) {
// Create a copy of this date object
var target = new Date(d.valueOf());
// ISO week date weeks start on monday
// so correct the day number
var dayNr = (d.getDay() + 6) % 7;
// Set the target to the thursday of this week so the
@sbp
sbp / json2yaml.sh
Created May 22, 2011 21:00
Convert JSON to YAML
#!/bin/sh
export PYTHONPATH=$HOME/usr/opt/pyyaml/lib/python2.6/site-packages
python -c '
import sys, json, yaml
with open(sys.argv[1]) as f:
print yaml.safe_dump(json.load(f), default_flow_style=False)
' $@