- Bytes and Blobs by David Flanagan
- Conference Wifi Redux by Malte Ubi
- Sashimi - https://github.com/cramforce/Sashimi
- Run Your JS everywhere with Jellyfish by Adam Christian - http://jelly.io Project
- Fighting Crime and Kicking Apps with Batman.js by Nick Small
- Hello Jo by Dave Balmer - Project - http://joapp.com
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
# CoffeeScript With Mixins | |
$ -> | |
template = _.templateFor '#meal-template' | |
meal = new Meal | |
_.focusOn '#entry' | |
_.onSumbitOf '#entry_form', -> | |
meal.add new Dish _.valOf '#entry' | |
_.setHtmlOf 'ul#meal', template meal.toJSON() |
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 Dish | |
constructor: (rawDescription="") -> | |
[all, @title, @price] = @parseRawDescription rawDescription | |
@price = new Money @price | |
parseRawDescription: (rawDescription) -> | |
pattern = /// | |
([^$]+) #Title | |
(\$\d+\.\d+) #Price | |
/// |
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
describe "Dish", -> | |
describe "constructor", -> | |
beforeEach -> | |
@dish = new Dish 'Sirloin Steak $18.99 mains' | |
it "extracts title", -> | |
(expect @dish.title).toEqual('Sirloin Steak') |
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
# Rewrote excellent intro to Backbone.js http://arturadib.com/hello-backbonejs/ in CoffeeScript | |
$ -> | |
Backbone.sync = (method, model, success, error) -> | |
success() | |
class Item extends Backbone.Model | |
defaults: | |
part1: 'hello' | |
part2: 'world' |
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
#1. install node, npm and coffeescript | |
#2. >npm install express | |
#3. >npm install node_redis | |
#4. >npm install -d | |
redis = require('redis').createClient() | |
redis.on 'error', (err) -> console.log "Redis connection error to #{redis.host} : #{redis.port} - #{err}" | |
app = require('express').createServer() | |
#create and increment multiple counters in redis, via: http://localhost:3000/counters/my-counter |
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
# Generate a sequence of numbers: | |
# - ordered with the highest values | |
# - has a sum of 1 | |
# - has an optional multiplier to alter the decreasing rate | |
sequence = (n,m=0) -> | |
f = (p,multiplier) -> p * p + multiplier | |
s = "" |
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
using System; | |
public class File { | |
public string Name { get; set; } | |
public string Read() { | |
return System.IO.File.ReadAllText(Name); | |
} | |
} | |
class Program { |
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
# All CoffeeScript examples from: https://github.com/jashkenas/coffee-script/blob/master/examples/computer_science/ | |
# All Java Script examples from: https://github.com/nzakas/computer-science-in-javascript - Copyright (c) 2009 Nicholas C. Zakas | |
# - Released under https://github.com/nzakas/computer-science-in-javascript/blob/master/LICENSE (*.js copyright headers reduced for clarity) | |
# Uses a binary search algorithm to locate a value in the specified array. | |
binary_search = (items, value) -> | |
start = 0 |