This file contains hidden or 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 () { | |
/* | |
TODO: Support more join types? | |
TODO: Support single key? | |
*/ | |
var crossProduct = function(objects1, objects2) { | |
var objects = []; |
This file contains hidden or 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 classic for-loop | |
var strings = ['1', '2', '3'], | |
numbers = []; | |
for (var i = 0; i < strings.length; i++) { | |
var number = parseInt(strings[i]); | |
numbers.push(number); | |
} | |
// numbers == [1, 2, 3] |
This file contains hidden or 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
#!/usr/bin/ruby | |
require 'open-uri' | |
require 'json' | |
require 'pp' | |
# Some example URLs; | |
# http://hypem.com/playlist/loved/JohnyTex/json/1/data.js | |
# http://hypem.com/playlist/popular/3day/json/1/data.js | |
# http://ws.spotify.com/search/1/track.json?q=little%20talks |
This file contains hidden or 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
foo_tests() -> | |
{foreach, | |
fun setup/0, | |
fun teardown/1, | |
[{"Should do something", | |
do_something()}]}. | |
setup() -> | |
Mods = [foo, bar], | |
meck:new(Mods), |
This file contains hidden or 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
-module(trees). | |
-export([build_tree/1]). | |
%% @doc Builds a (proplist-based) tree from a proplist where each key | |
%% is a list of keys. | |
build_tree(Proplist) -> | |
build_tree(Proplist, []). | |
build_tree([], Tree) -> |
NewerOlder