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
| player = jtv_api.new_player(document.getElementById('video_container'), { | |
| width:'100%', | |
| height:'100%', | |
| custom:true, | |
| consumer_key:'yjw6J88EzQ2kCj8NhBXA', | |
| events : { | |
| stream_lost : play_random, | |
| video_not_found : play_random, | |
| } | |
| }); |
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 tail = function(fname, onData) { | |
| fs.open(fname, 'a+', function(err, fd) { | |
| puts('fd:'+fd); | |
| if (err) { | |
| puts('error!: '+err); | |
| setTimeout(function(){ | |
| tail(fname, onData); | |
| }, 10); | |
| } else { | |
| puts('allocating buffer'); |
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 tail = function(fname, onData, ender) { | |
| fs.open(fname, 'a+', function(err, fd) { | |
| if (err) { | |
| puts('error!: '+err); | |
| if (ender(fd, 0) !== false) { | |
| setTimeout(function(){ | |
| tail(fname, onData); | |
| }, 10); | |
| } | |
| } else { |
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 tail = function(fname, onData, ender) { | |
| fs.open(fname, 'a+', function(err, fd) { | |
| if (err) { | |
| puts('tail error: '+err); | |
| if (ender(fd, 0) !== false) { | |
| setTimeout(function(){ | |
| tail(fname, onData); | |
| }, 10); | |
| } | |
| } else { |
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
| from twisted.internet.defer import Deferred | |
| def noop(*args): | |
| return args | |
| class proxy(object): | |
| def __init__(self, fn): | |
| self.defer = Deferred() | |
| self.fn = fn |
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
| def doThing(important, information): | |
| return dataDependency(important, information).addCallback(_doThing, important, information) | |
| def _doThing(data, important, information): | |
| ... |
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
| @after(dataDependency) | |
| def doThing(data, important, information): | |
| ... |
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
| from twisted.web.client import getPage | |
| import json | |
| @after(getPage, key=lambda channel: "http://api.justin.tv/api/stream/list.json?channel=%s" % channel) | |
| def viewer_count(response, channel): | |
| data = json.loads(response) | |
| return data[0]['stream_count'] |
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
| @after(getFromDatabase) | |
| @after(getFromWeb) | |
| def got_data(from_database, from_web): | |
| ... |
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
| MidiIn min; | |
| MidiMsg msg; | |
| if (!min.open(0)) me.exit(); | |
| SinOsc s => Gain g => DelayL d => dac; | |
| s => Gain g2 => dac; | |
| d => Gain g3 => d; | |
| 15::ms => d.delay; | |
| 0.1 => g.gain; |
OlderNewer