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
write = (buffer) -> | |
offset = if arguments.length > 1 then arguments[1] else 0 | |
length = if arguments.length > 2 then arguments[2] else buffer.length | |
done = false | |
while not done and machine isnt null and offset < length | |
pattern = machine.definition.pattern[machine.index] | |
if pattern.arrayed | |
loop | |
buffer[offset] = machine.value[machine.offset] | |
machine.offset += machine.increment |
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
write = (buffer, offset, length) -> | |
offset or= 0 | |
length or= buffer.length | |
while machine and offset < length | |
pattern = machine.definition.pattern[machine.index] | |
if pattern.arrayed | |
loop | |
buffer[offset] = machine.value[machine.offset] | |
machine.offset += machine.increment | |
bytesWritten++ |
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
app = require('express').createServer() | |
md = require('node-markdown').Markdown | |
app.get '/', (req, res) -> | |
res.send md "Hello, *world*! The time is\n\n**#{ new Date() }**" | |
app.listen 3000 | |
console.log 'Now listening on port 3000' |
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
//Working JS | |
var server = Connect.createServer( | |
Connect.logger(), | |
Connect.staticProvider(__dirname + '/public'), | |
function(req, res) { | |
res.writeHead(200, { 'Content-Type': 'text/plain' }); | |
res.write('Hello World'); | |
res.end(); | |
} |
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
@sendNameChange($('#username').attr 'value' ) unless | |
$("#username").css('display') is 'none' and | |
$("#username").attr("value").search("user") is -1 |
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 Product = Backbone.Model.extend({ | |
fromStoreName: function() { return 'Crate & Barrel'; } | |
}); | |
var glassJar = new Product({ storesUrl: 'http://www.crateandbarrel.com' }); | |
var products = new Backbone.Collection; | |
products.add([glassJar]); |
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
class ViewModel | |
firstName: ko.observable 'Bob' | |
lastName: ko.observable 'Smith' | |
constructor: | |
names = -> @firstName() + ' ' + @lastName() | |
@fullName = ko.dependentObservable names, 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
assert.deepEqual item, { | |
x: 1 | |
y: 2 | |
} | |
# Or: | |
assert.deepEqual item, |
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
package_assets: on # (on, off, always) | |
embed_assets: on # (on, off, datauri) | |
compress_assets: on # (on, off) | |
gzip_assets: on # (on, off) | |
template_function: _.template # (defaults to the built-in micro-templating) | |
package_path: packages # (defaults to assets) | |
javascript_compressor: closure # (yui, closure) | |
compressor_options: | |
compilation_level: ADVANCED_OPTIMIZATIONS |
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
getstyles -> | |
result = {} | |
for key in arguments | |
result[key] = this.getStyle(key) | |
return result |