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 ($) { | |
| // this is a binary search that operates via a function | |
| // func should return < 0 if it should search smaller values | |
| // func should return > 0 if it should search larger values | |
| // func should return = 0 if the exact value is found | |
| // Note: this function handles multiple matches and will return the last match | |
| // this returns -1 if no match is found | |
| function binarySearch(length, func) { | |
| var low = 0; |
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 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys | |
| if (!Object.keys) { | |
| Object.keys = (function () { | |
| 'use strict'; | |
| var hasOwnProperty = Object.prototype.hasOwnProperty, | |
| hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'), | |
| dontEnums = [ | |
| 'toString', | |
| 'toLocaleString', | |
| 'valueOf', |
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
| if (!Array.prototype.indexOf) { | |
| Array.prototype.indexOf = function (searchElement, fromIndex) { | |
| if ( this === undefined || this === null ) { | |
| throw new TypeError( '"this" is null or not defined' ); | |
| } | |
| var length = this.length >>> 0; // Hack to convert object.length to a UInt32 | |
| fromIndex = +fromIndex || 0; |
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
| if (!Array.prototype.filter) { | |
| Array.prototype.filter = function(fun/*, thisArg*/) { | |
| 'use strict'; | |
| if (this === void 0 || this === null) { | |
| throw new TypeError(); | |
| } | |
| var t = Object(this); | |
| var len = t.length >>> 0; |
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 destroyViews(views){ | |
| if (!views) { return; } | |
| var v; | |
| if ($.isArray(views)) { | |
| for (var i=0; i<views.length; i++) { | |
| v = views[i]; | |
| if(v && $.isArray(v)){ | |
| destroyViews(v); | |
| } else { | |
| v && v.destroy && v.destroy(); |
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(env){ | |
| env.Mixins.Events = { | |
| bindEvents: function(events) { | |
| if (!this._bEvents) { | |
| this._bEvents = []; | |
| } | |
| for (var i=0,evt; evt=events[i]; i++) { |
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
| ########################################################################### | |
| ## Playing around with the awesome Echonest Remix API. | |
| ## | |
| ## http://code.google.com/p/echo-nest-remix/ | |
| ## | |
| ## This is a script that will loop 4 beats from track 1 and mix them | |
| ## behind track 2., also syncing the track tempos | |
| ## | |
| ## Change the variables below. | |
| ########################################################################### |
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
| /** | |
| * SocketManager - Singleton to manage multi-channel socket 'routing', need a way to merge with socket.io so client sessions aren't stored twice in memory, | |
| * | |
| * Requires Socket.IO-node and Socket.IO client libraries. | |
| * | |
| * Usage: | |
| * in your main app.js file (or whereever you create the server) | |
| * | |
| * var io = require('socket.io'), | |
| * sm = require('socketmanager'); |
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
| cd /path/to/files/ | |
| for fl in *.js; do | |
| mv $fl $fl.old | |
| sed -e 's/find_string/replace_string/' $fl.old > $fl | |
| rm -f $fl.old | |
| done |
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
| /** | |
| * Node.js implementation of Tokbox's OpenTokSDK | |
| * | |
| * by Brian Stoner | |
| * | |
| * var tokbox = require('./tokbox') | |
| * | |
| * var t = new tokbox.OpenTokSDK(API_KEY,API_SECRET) | |
| * | |
| * t.createSession('127.0.0.1', {}, function(session){ |
OlderNewer