Instantly share code, notes, and snippets.

😎
hack the planet

# Chris Schepmancschep

😎
hack the planet
• Sort options
Last active Aug 29, 2015
View gist:6edcd56017b3176f1d2c
 var towerSolver = function(blocks) { var result = 0; var wallHeight = 0; var underWater = []; for (var i = 0; i < blocks.length; i++) { if (blocks[i] >= wallHeight || i === blocks.length - 1) { var smallestWall = Math.min(blocks[i], wallHeight); wallHeight = blocks[i];
Created Apr 23, 2015
View gist:841dd3f4e274e75d4d34
 var asyncMap = function(tasks, callback){ var results = []; var tasksCompleted = 0; var makeCallBack = function(i) { return function(x) { results[i] = x; tasksCompleted++; if (tasksCompleted === tasks.length) {
Last active Aug 29, 2015
View gist:d170c165286d6cc722a4
 /* * Return an array with the power set of a given string. * Definition of power set: The set of all possible subsets including the empty set. * * Example: * * powerSet("abc") * -> [ '' , 'a', 'b', 'c', 'ab', 'ac', 'bc', 'abc' ] * * Note:
Created Mar 24, 2015
javascript closure example
View gist:4181917ce4c78f457816
 a quick example
Created Apr 5, 2012
awesome code
View gist:2312412
 x = 0 while x < 10: x = int(raw_input("What'll it be?")) if x < 10: print "It's only %d ya know." % x else: print "I guess it's too high now."
Created Oct 17, 2011
View gist:1294115
 // Enumerate Albums ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; [library enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:assetGroupEnumerator failureBlock:assetGroupEnumberatorFailure]; [library release];
Created Oct 7, 2011
View gist:1271475
 // Load Albums into assetGroups dispatch_async(dispatch_get_main_queue(), ^ { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // Group enumerator Block void (^assetGroupEnumerator)(struct ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop) { if (group == nil) {
You can’t perform that action at this time.