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 getQueryParams(qs) { | |
qs = qs.split('+').join(' '); | |
var params = {}; | |
var tokens; | |
var re = /[?&]?([^=]+)=([^&]*)/g; | |
while (tokens = re.exec(qs)) { | |
params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); | |
} | |
return params; | |
} |
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
moduleKeywords = ['extended', 'included'] | |
class App.Classes.Module | |
@extend: (obj) -> | |
for key, value of obj when key not in moduleKeywords | |
@[key] = value | |
obj.extended?.apply(@) | |
@ |
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 getChunkedString(str) { | |
return str.match(/.{1,3}/g).join('-'); | |
} |
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
class Hex { | |
static DIRECTIONS = [ | |
new Hex({ q: 1, r: 0, s: -1 }), | |
new Hex({ q: 1, r: -1, s: 0 }), | |
new Hex({ q: 0, r: -1, s: 1 }), | |
new Hex({ q: -1, r: 0, s: 1 }), | |
new Hex({ q: -1, r: 1, s: 0 }), | |
new Hex({ q: 0, r: 1, s: -1 }), | |
]; |