Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env coffee
# Ext JS Connect
# Copyright(c) 2010 Ext JS, Inc.
# MIT Licensed
# Module dependencies.
child_process: require 'child_process'
netBinding: process.binding 'net'
iota github/manveru/kimochi % vows spec.coffee
/home/manveru/.node_libraries/.npm/vows/0.4.6/package/lib/vows/context.js:28
if (e) { that.emitter.emit('error', e) }
^
TypeError: Cannot call method 'emit' of null
at /home/manveru/.node_libraries/.npm/vows/0.4.6/package/lib/vows/context.js:28:47
at EventEmitter._tickCallback (node.js:50:25)
at node.js:255:9
vows: require 'vows'
assert: require 'assert'
Kimochi: require './kimochi'
model: Kimochi.connect 'vows_spec'
vows.describe('Kimochi',
{ 'A model creates the database': {
topic: -> model.create @callback
'without errors': (result) ->
cradle: require 'cradle'
sys: require 'sys'
p: () ->
for arg in arguments
sys.puts(sys.inspect(arg, false, 5))
class ModelInstance
constructor: (doc) ->
@doc: doc
words = {
'hello' => 100,
'world' => 50,
'this' => 200,
}
storage = {}
sum = 0
words.each do |word, weight|
@manveru
manveru / rpx.coffee
Created July 5, 2010 15:24
Interface with janrain
url: require 'url'
querystring: require 'querystring'
request: require 'request'
class Rpx
constructor: (apiKey) ->
@apiKey: apiKey
authInfo: (token, callback) ->
@apiCall 'auth_info', {token: token}, (data) ->
#!/usr/bin/env coffee
# Ext JS Connect
# Copyright(c) 2010 Ext JS, Inc.
# MIT Licensed
# Module dependencies.
child_process: require 'child_process'
netBinding: process.binding 'net'
router.post('/save').
bind (req, res, next) ->
chunks: []
req.addListener 'data', (chunk) ->
chunks.push chunk
req.addListener 'end', ->
totalLength: chunks.reduce (sum, chunk) ->
sum + chunk.length
@manveru
manveru / sc.rb
Created June 24, 2010 17:04 — forked from rklemme/sc.rb
iota % rvm ruby sc.rb
info: jruby-1.5.1: jruby 1.5.1 (ruby 1.9.2dev trunk 24787) (2010-06-06 f3a3480) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_20) [amd64-java]
Rehearsal ----------------------------------------------
scan 5.973000 0.000000 5.973000 ( 5.928000)
scan ++ 10.103000 0.000000 10.103000 ( 10.104000)
scan re 5.443000 0.000000 5.443000 ( 5.443000)
scan re ++ 10.329000 0.000000 10.329000 ( 10.329000)
while 8.482000 0.000000 8.482000 ( 8.482000)
(function(){
var Router, router;
Router = require('biggie-router');
router = new Router();
router.get(/\.(css|js|svg)$/).module('gzip');
router.module('static', './public');
router.bind(function(req, res, next) {
return res.sendBody(404, "File not found");
});
router.listen(8080);