gem install rails --pre
rails new my_app -T
isArray = Array.isArray or (obj) -> | |
obj.constructor.toString().indexOf("Array") isnt -1 | |
default_max_listeners = 10 | |
class EventEmitter | |
setMaxListeners: (n) -> | |
@_events.maxListeners = n | |
emit: (type) -> |
// from Horofox in #node.js | |
var mongoose = require('mongoose'); | |
var db = mongoose.connect('mongodb://localhost/mydb'); | |
function allowPosts(mongoose) { | |
var Schema = mongoose.Schema; | |
var Posts = new Schema({ | |
name : String, | |
subject: String, | |
comment : String, |
var mongoose = require('mongoose') | |
, Futures = require('futures') | |
, Schema = mongoose.Schema | |
, db = mongoose.connect('mongodb://localhost/mongoose-db'); | |
var UserSchema = new Schema({ | |
"name": {type: String}, | |
"location": { | |
"latitude": {type: Number, required: true, min: -90, max: 90}, | |
"longitude": {type: Number, required: true, min: -180, max: 180} |
# This example does an AJAX lookup and is in CoffeeScript
$('.typeahead').typeahead(
# source can be a function
source: (typeahead, query) ->
# this function receives the typeahead object and the query string
by Jonathan Rochkind, http://bibwild.wordpress.com
Capistrano automates pushing out a new version of your application to a deployment location.
I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
## Get FFMpeg working on heroku by building binaries using vulcan | |
gem install vulcan | |
vulcan create foo | |
git clone --depth 1 git://source.ffmpeg.org/ffmpeg | |
cd ffmpeg |
(* author: Dimitur Krustev *) | |
(* started: 20130616 *) | |
(* based on: http://siek.blogspot.com/2013/05/type-safety-in-three-easy-lemmas.html *) | |
Require Import Arith List Bool. | |
Set Implicit Arguments. | |
Section Lang. |
I'm going to start off by motivating what I'm doing here. And I want to be clear that I'm not "dissing" the existing collections implementation or anything as unproductively negative as that. It was a really good experiment, it was a huge step forward given what we knew back in 2.8, but now it's time to learn from that experiment and do better. This proposal uses what I believe are the lessons we can learn about what worked, what didn't work, and what is and isn't important about collections in Scala.
This is going to start out sounding really negative and pervasively dismissive, but bear with me! There's a point to all my ranting. I want to be really clear about my motivations for the proposal being the way that it is.