Some exercises from the Falsy Values workshops.
The good parts:
- HTTP server and client in same script
- Express cookies example
- Express routing example
- Express error handling
- Express middlewares example
- Simple HTTP proxy
var view = new CounterView({ | |
collection: new NotificationsCollection() | |
}); | |
this.spy(view, 'render'); | |
view.collection.add([{}]); | |
assert(view.render.calledOnce); |
var ListCollection = Backbone.Collection.extend({ | |
model: Bid, | |
comparator: function (bid) { | |
return -(new Date(bid.get('date'))).getTime(); | |
}, | |
sortASC: function (key) { | |
return this.sortBy(function (model) { | |
return model.get(key); |
jshint: { | |
options: { | |
"browser": true, | |
"node": false, | |
.. | |
"maxlen": 80, | |
globals: { | |
myBrowserGlobal: true | |
}, | |
reporters: [ |
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
<?php | |
$a = 0; | |
$b = 'x'; | |
var_dump(FALSE == $a); | |
var_dump($a == $b); | |
var_dump($b == TRUE); | |
?> |
info: Welcome to Nodejitsu chazm | |
info: jitsu v0.9.8 | |
info: It worked if it ends with Nodejitsu ok | |
info: Executing command deploy | |
info: Analyzing application dependencies in app.js | |
/usr/local/lib/node_modules/jitsu/node_modules/require-analyzer/node_modules/npm/lib/npm.js:299 | |
if (!conf.hasOwnProperty("prefix")) { | |
^ | |
TypeError: Object #<error> has no method 'hasOwnProperty' |
error: Error running command deploy | |
error: Nodejitsu Error (500): Internal Server Error | |
error: There was an error while attempting to deploy your application. | |
error: | |
error: NPM Install failed | |
error: NPM failed to install dependencies | |
error: | |
error: This type of error is usually a user error. | |
error: Error output from Haibu: | |
error: |
//v1 | |
switch (i) { | |
case '1': | |
execFirstMethod(); | |
break; | |
case '2': | |
execSecondMethod(); | |
break; | |
} |
Some exercises from the Falsy Values workshops.
The good parts: