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 MyThing = function () { | |
this.a = function () { | |
}; | |
this.b = []; | |
this.c = 'foo'; | |
}; | |
MyThing.prototype = new (function () { | |
var MY_SETTING = 2112; | |
var _myPrivateFunc = 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
js> null > -1; | |
true | |
js> null < 1; | |
true | |
js> null > 0; | |
false | |
js> null < 0; | |
false | |
js> null == 0; | |
false |
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
js> isNaN(null); | |
false | |
js> null > -1; | |
true | |
js> null < 1; | |
true | |
js> null > 0; | |
false | |
js> null < 0; | |
false |
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 Response = require('ringo/webapp/response').Response | |
, Request = require('ringo/webapp/request').Request | |
, defer = require('ringo/promise').defer | |
, jsdeps = require('../jsdeps/index') | |
, setTimeout = require('ringo/scheduler').setTimeout; | |
exports.packages = function(req) { | |
var response = defer() | |
, params | |
, prereqs |
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
// $('myDiv').bind('click', $.proxy(this.myFunc, this)); |
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 foo = {a: function () { console.log(this.b); }, b: true}; | |
> foo.b; | |
true | |
> foo.a; | |
[Function] | |
> foo.a(); | |
true | |
> var bar = foo.a; | |
> foo; | |
{ a: [Function], b: true } |
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; | |
desc('Do thing 1'); | |
task('thing1', [], function () { | |
var cmds = ['node -e "console.log(\'--> Thing 1... Executing\')"']; | |
console.log('--> Thing 1... Starting'); | |
jake.exec(cmds, function () { | |
var echo = spawn('echo', |
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
// User, hasOne Profile | |
var u = User.create({ | |
login: 'asdf' | |
, password: 'zerb' | |
, confirmPassword: 'zerb' | |
}); | |
// Owner has to be saved to add an association | |
u.save(function (err, data) { | |
if (err) { | |
throw err; |
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
" JS syntax for Jakefiles | |
au BufRead,BufNewFile Jakefile set filetype=javascript | |
" JS syntax for .jake files | |
au BufRead,BufNewFile *.jake set filetype=javascript |
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 Item = function () { | |
this.defineProperties({ | |
name: {type: 'string'} | |
}); | |
this.findByName = function (name, callback) { | |
geddy.model.Item.all({name: name}, callback); | |
} | |
} |