This file contains hidden or 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
| class A | |
| foo: -> "foo" | |
| bar: (cb)-> cb() | |
| a = new A | |
| b = a.bar | |
| b a.foo #gets me "foo" |
This file contains hidden or 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
| closure_creator = (value)-> | |
| -> value * value | |
| result = [] | |
| for i in [1..3] | |
| result.push closure_creator i | |
| for f in result | |
| console.log f() |
This file contains hidden or 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
| result = [] | |
| for i in [1..3] | |
| result.push -> i * i | |
| for f in result | |
| console.log f() |
This file contains hidden or 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
| require "rubygems" | |
| require "bundler/setup" | |
| require 'celluloid' | |
| require 'yaml' | |
| require 'data_mapper' | |
| require './src/config_reader.rb' | |
| require './src/sensor.rb' | |
This file contains hidden or 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
| require 'mongoid' | |
| class Data | |
| include Mongoid::Document | |
| field :text | |
| end | |
| Mongoid.configure do |config| | |
| config.sessions = { | |
| :default => { | |
| :hosts => ["127.0.0.1:27017"], |
This file contains hidden or 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
| ######################## crafty.js:7740 | |
| avg drawing time: 6.5435869565217395 crafty.js:7741 | |
| avg drawing time cycle: 9.13 crafty.js:7742 | |
| avg dirty rects1: 29.44 crafty.js:7743 | |
| avg dirty rects2: 16.21 crafty.js:7744 | |
| avg objects: 367.2648913043478 crafty.js:7745 | |
| avg objects cycle: 399.8 crafty.js:7746 | |
| avg area cycle: 11206498.56 crafty.js:7747 | |
| -------------------- crafty.js:7758 | |
| 100 Frame: 9242 crafty.js:7759 |
This file contains hidden or 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
| draw: function draw() { | |
| var s0 = new Date().getTime(); | |
| var len_dirty_rects1 = dirty_rects.length; | |
| var drects1 = _.clone(dirty_rects); | |
| //if nothing in dirty_rects, stop | |
| if (!dirty_rects.length && !dom.length) return; | |
| var i = 0, l = dirty_rects.length, k = dom.length, rect, q, |
This file contains hidden or 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
| macro lock { | |
| case ($x) $block => { | |
| locking($x, function); | |
| } | |
| } | |
| lock ("A") { | |
| console.log("foo"); | |
| }; |
This file contains hidden or 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
| #take care I am using requirejs for modules | |
| define [], -> | |
| Enum = (enumeration)-> | |
| check = (value)-> | |
| newval = null | |
| for key, val of enumeration | |
| if val == value | |
| newval = value | |
| break |
This file contains hidden or 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
| class A | |
| class B | |
| # packages and their artifacts must be defined as object literals | |
| window.foobaz = { | |
| A | |
| B | |
| } |