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
// Thing constructor | |
var Thing = function(){ | |
this.pies = ['cherry','apple']; | |
}; | |
Thing.prototype = {}; | |
Object.defineProperties( Thing.prototype, { | |
piescount: { | |
get: function(){ return this.pies.length; } |
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 shoe = require('shoe'); | |
var through = require('through'); | |
var result = document.getElementById('result'); | |
var stream = shoe('/chat'); | |
stream.on( 'data', function( msg ){ | |
console.log( 'data', msg ); | |
}); |
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 getElementsByClass = function( classname ){ | |
var els_with_class = []; | |
var els = document.getElementsByTagName('*'); | |
for( var i = 0; i < els.length; i++ ){ | |
var el = els[i]; | |
if( el.className.split(' ').indexOf( classname ) > -1 ) els_with_class.push( el ); | |
} | |
return els_with_class; | |
}; |
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 $ = require('jquery'); | |
// Set up hbsfy for Solidus feature parity | |
var Handlebars = require('hbsfy/runtime'); | |
// Pull in Handlebars helpers | |
var HandlebarsHelper = require('handlebars-helper'); | |
HandlebarsHelper.help( Handlebars ); | |
// Set partials | |
Handlebars.registerPartial( 'favorite', require('../../views/favorite.hbs') ); |
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 gulp = require('gulp'); | |
var vinylSource = require('vinyl-source-stream'); | |
var watchify = require('watchify'); | |
gulp.task( 'browserify', function(){ | |
// use watchify instead of gulp-browserify and gulp.watch | |
var bundler = watchify('./src/universe-experiment.js'); | |
bundler.transform('hbsfy'); | |
bundler.transform('uglifyify'); | |
var rebundle = function(){ |
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 NO_OP = function(){}; | |
var domready = require('domready'); | |
var sizzle = require('sizzle'); | |
var elClass = require('element-class'); | |
var jsonp = require('jsonp'); | |
var xhr = require('xhr'); | |
var Modular = function( config ){ | |
this.url = config.url; |
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 rpc = require('rpc-stream'); | |
var engine = require('engine.io-stream'); | |
var rpc_client = rpc(); | |
var engine_stream = engine('/test'); | |
remote = rpc_client.wrap(['addMessage']); | |
engine_stream | |
.pipe( rpc_client ) |
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
// assume this is node.js/browserify land so this is actually private | |
var next_server_number = function( servers ){ | |
var current_int = 1; | |
servers = servers.sort( function( a, b ){ | |
return a - b; | |
}); | |
for( var i = 0; i < servers.length; i++ ){ | |
if( current_int === servers[i] ){ | |
current_int++; | |
} |
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
Uncaught exception: Error: Firebase.child failed: First argument was an invalid path: "null". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]" | |
Error thrown at line 3, column 2 in g(a) in https://cdn.firebase.com/v0/firebase.js: | |
throw a; | |
called from line 275, column 2 in Ia(a, b) in https://cdn.firebase.com/v0/firebase.js: | |
(!u(b) || 0 === b.length || ya.test(b)) && g(Error(A(a, 1, l) + 'was an invalid path: "' + b + '". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')) | |
called from line 3844, column 4 in <anonymous function: H.prototype.F>(a) in https://cdn.firebase.com/v0/firebase.js: | |
Ia("Firebase.child", a); | |
called from line 106, column 2 in createUserNode(username) in https://dl.dropboxusercontent.com/u/1330446/geochat/js/scripts.js: | |
userRef = allUserRef.child(username); |
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 dom = require('domquery'); | |
var domready = require('domready'); | |
var forEach = Array.prototype.forEach; | |
var getFormData = function( form ){ | |
var form_data = {}; | |
forEach.call( form.elements, function( el, i ){ | |
switch( el.tagName ){ | |
case 'INPUT': | |
case 'TEXTAREA': |
OlderNewer