JSConf.eu opening song - JavaScript Will Listen - Bella Morningstar
- Plask - Dean McNamee
- Plask
Function.prototype.intercept = function(callback) { | |
var underlyingObservable = this; | |
return ko.dependentObservable({ | |
read: underlyingObservable, | |
write: function(value) { callback.call(underlyingObservable, value) } | |
}); | |
}; | |
viewModel.lastName = ko.observable("some initial value").intercept(function(value) { | |
// Only accepts strings of length < 20 |
#model | |
class Week < ActiveRecord::Base | |
def weeks=(weeks) | |
self.week = weeks.reject(&:blank?) * "," | |
end | |
def weeks | |
self.week.split(",") | |
end |
//before | |
switch(action) { | |
case: "new" | |
return "create"; | |
case: "edit" | |
return "update"; | |
default: | |
return "unknown"; | |
}; |
/** | |
@author: A.J <[email protected]> | |
@date: 2011-10-11 | |
@version: 0.1 | |
@param {Array} arr | |
@return Object | |
*/ | |
var arr = ["a", "b", "c", "d", "e"]; | |
function objectify( arr ) { |
sys = require 'sys' | |
http = require 'http' | |
host = "0.0.0.0" | |
port = 3000 | |
http.createServer (request,response) -> | |
[_, op, a, b] = request.url.split "/" | |
a = parseInt a | |
b = parseInt b | |
result = { | |
"add": (a, b) -> a + b |
#ruby-1.9.2-p290 | |
e = [*1..9].each # => #<Enumerator: [1, 2, 3, 4, 5, 6, 7, 8, 9]:each> | |
e.next # => 1 | |
e.next # => 2 | |
e.rewind # => #<Enumerator: [1, 2, 3, 4, 5, 6, 7, 8, 9]:each> | |
e.next # => 1 |
vows = require 'vows' | |
assert = require 'assert' | |
#Document = require('../../models/document') | |
## model ## | |
mongoose = require 'mongoose' | |
Schema = mongoose.Schema | |
ObjectId = Schema.ObjectId | |
db = mongoose.connect 'mongodb://localhost:27017/notepad' | |
DocumentSchema = new Schema |
require 'test/unit' | |
require 'rubygems' | |
gem 'activesupport' | |
require 'active_support/core_ext/module' | |
class Original | |
def hello | |
"Original" | |
end | |
end |
vows = require 'vows' | |
assert = require 'assert' | |
tobi = require 'tobi' | |
vows.describe('Root').addBatch | |
'브라우저에서': | |
topic: -> tobi.createBrowser 3000, 'localhost' | |
'GET /의': | |
topic: (topic) -> | |
topic.get "/", @callback.bind(@, null) |