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
function beginningOfMonth(date){ | |
if(typeof date === 'undefined'){ | |
date = new Date(); | |
} | |
date.setMilliseconds(0); | |
date.setSeconds(0); | |
date.setMinutes(0); | |
date.setHours(0); | |
date.setDate(1); | |
return new Date(date); |
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
// $('img.photo',this).imagesLoaded(myFunction) | |
// execute a callback when all images have loaded. | |
// needed because .load() doesn't work on cached images | |
// mit license. paul irish. 2010. | |
// webkit fix from Oren Solomianik. thx! | |
// callback function is passed the last image to load | |
// as an argument, and the collection as `this` |
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
# The goal is to traverse a tree and return an array A[0...h], where h is the height | |
# of the tree and A[i] is an array of items at height i. | |
# example: | |
# tree -> | |
# 0 | |
# 1 2 | |
# 3 4 5 6 | |
# 7 8 9 10 11 12 13 14 | |
# | |
# should give you: |
NewerOlder