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
Show hidden characters
{ | |
"presets": ["module:metro-react-native-babel-preset"], | |
} | |
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
catRef = new Firebase(...) | |
class Cat | |
constructor: (@name) -> | |
catRef.push | |
name: @name | |
pounce: ... | |
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
/////////////// | |
// CONSTANTS | |
/////////////// | |
var DATE = 0, | |
FB_LINK = 1, | |
HOSTS = 2, | |
DJS = 3, | |
INSTRUCTORS = 4, | |
DOOR = 5, | |
NOTES = 6, |
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
var a = [1, 2, 3, 4, 5]; | |
var b = [6, 7, 8, 9, 0]; | |
a.forEach(function(var) { | |
b.forEach(function(val) { | |
console.log(var + val); | |
}); | |
}); |
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() { | |
var fs, getBridge, getUser, getUsernameForBridge, hslLights, hue, keypress, mod, q, startKeypress, toggleWarmWhite, _; | |
fs = require('fs'); | |
_ = require('underscore'); | |
hue = require("node-hue-api"); | |
q = require("q"); |
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
# Create dataset | |
people = [{'salary': i} for i in range(20000)] | |
for person in people: | |
person['friends'] = [(i + person['salary']) % 20000 for i in range(10)] | |
# people = [..., {'salary': 12308, 'friends': [12308, 12309, 12310, 12311, 12312, 12313, 12314, 12315, 12316, 12317]}, ...] | |
for person in people: | |
total_salary = 0 | |
for friend in person.nominated_friends: |
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
downloadChunk = (url, start, end) -> | |
xhr = new window.XMLHttpRequest() | |
deferred = Q.defer() | |
xhr.open "GET", url, true | |
xhr.setRequestHeader "range", "bytes=" + start + '-' + end | |
xhr.onload = -> | |
if @status == 200 | |
defer.resolve @response |
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
doThisUntilItWorks = () -> | |
doSomethingAsync().then (result) -> | |
doSomething result | |
, (reason) -> | |
console.warn "Retrying" | |
deferred = Q.deferred() | |
setTimeout (-> | |
deferred.resolve(doThisUntilItWorks()) | |
), retryDelay |
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
a = 'welldone' | |
b = 'tinyurl.com' | |
def get_letter_for_number(n): | |
""" Return the alphabet letter for index n | |
>>> get_letter_for_number(1) | |
a | |
>>> get_letter_for_number(26) |