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
var MyCollection = Backbone.Collection.extend({ | |
reset: function(models, options) { | |
return Backbone.Collection.reset.call(this, models.results, options); | |
} | |
}); |
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
<?php | |
function mailer($smtpHost) { | |
return function($from, $to, $subject, $content) use ($smtpHost) { | |
mail(...); | |
}; | |
} | |
$myMailer = mailer('smtp.google.com'); |
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
$('li', 'ul') | |
.fork( | |
$.branch('.active').show(), | |
$.branch(':not(.active)').hide() | |
); |
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
var speak = function(text, cb) { | |
var u = new SpeechSynthesisUtterance(); | |
u.text = text; | |
u.lang = 'de-DE'; | |
u.rate = 1; | |
if (cb) u.onend = cb; | |
speechSynthesis.speak(u); | |
}; |
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
var data { | |
id_1: true, | |
id_2: true, | |
id_3: true | |
}; | |
var lookup = function(dict) { | |
return function(key) { | |
return dict[key]; | |
}; |
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
$.fn.sorty = function(fn) { | |
return this.each(function() { | |
var $el = $(this); | |
$el.html($el.children().sort(fn)); | |
}); | |
}; |
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
var spawn = require('child_process').spawn; | |
var tailStream = function(file) { | |
return spawn('tail', ['-f', file]).stdout; | |
}; | |
tailStream('./blah.txt').pipe( ... ); |
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
var net = require('net'); | |
var HOST = 'localhost'; | |
var PORT = 7777; | |
var WORKERS = 1; | |
var TIMEOUT = 30; // sec | |
var data = 'FLOODATTACK'; | |
var counter = 0; | |
var circulate = function(arr) { |
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
var localfiles = function(opts, player, type, next) { | |
if (type !== 'launch') return next(); | |
if (isUrl(opts.path)) return next(); | |
// start local webserver, change the path to an url | |
}; | |
var defaultmedia = function(opts, player, type, next) { | |
player.on('app-launch-pre', function(err, app) { |
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
var castv2Cli = require('castv2-client'); | |
var inherits = require('util').inherits; | |
var Application = castv2Cli.Application; | |
var RequestResponseController = castv2Cli.RequestResponseController; | |
var extend = require('xtend'); | |
var noop = function() {}; | |
var slice = Array.prototype.slice; | |
var Api = function(client, session) { | |
var that = this; |