Skip to content

Instantly share code, notes, and snippets.

/**
* Module dependencies.
*/
var express = require('express');
// Create the server
app = express.createServer();
@joshsmith
joshsmith / gist:1422191
Created December 2, 2011 07:28
Proof that I'm not insane. Logs are backwards
Joshua-Smiths-MacBook-Pro:wadsup joshsmith$ jitsu logs app wadsupinfo: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command logs app wadsup
info: Authenticated as joshsmith
data: 2011-12-02T07:22:53.644Z: ...finished step
data: 2011-12-02T07:22:53.644Z: starting step - compile
data: 2011-12-02T07:22:53.644Z: ...finished step
data: 2011-12-02T07:22:53.644Z: starting step - addToSession
data: 2011-12-02T07:22:53.644Z: ...finished step
data: 2011-12-02T07:22:53.644Z: starting step - sendResponse
@joshsmith
joshsmith / gist:1424813
Created December 2, 2011 20:58
Log output of form.parse()
{ error: null,
ended: false,
maxFieldsSize: 2097152,
keepExtensions: false,
uploadDir: '/Users/joshsmith/Sites/Node/wadsup/tmp',
encoding: 'utf-8',
headers:
{ host: 'localhost:3000',
connection: 'keep-alive',
'content-length': '226812',
@joshsmith
joshsmith / gist:1428154
Created December 3, 2011 21:07
Jitsu error with name/subdomain combo
Joshua-Smiths-MacBook-Pro:wadsup joshsmith$ jitsu deploy
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Authenticated as joshsmith
info: Analyzing your application dependencies in app.js
warn: No application exists for wadsup
info: Checking app availability wadsup
error: Error creating wadsup
error: App name / subdomain combination is not available
@joshsmith
joshsmith / Output
Created December 4, 2011 02:03
First use of vows
♢ InterestModel
The InterestModel can get an interest by name
✓ should be named "28 Days Later"
✓ OK » 1 honored (0.006s)
@joshsmith
joshsmith / gist:1431472
Created December 4, 2011 22:19
How should I be doing the callback?
user.save().on('success', function(user) {
callback(user);
})
.on('failure', function(error) {
callback(error);
});
@joshsmith
joshsmith / gist:1431555
Created December 4, 2011 22:53 — forked from Marak/gist:1431484
How should I be doing the callback?
user.save().on('success', function(user) {
callback(null, user);
}).on('failure', function(error) {
callback(user);
});
LOAD DATA LOCAL INFILE '/Users/joshsmith/worldcitiespop.csv'
INTO TABLE cities
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(country,ascii,city,region,population,latitude,longitude);
[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
@joshsmith
joshsmith / company.js
Created January 6, 2012 19:26
company.js
var Company = function() {
this.crypto = require('ezcrypto').Crypto;
}
// Create the company
Company.prototype.create = function (name, contact, email, password) {
result = this.hashPassword(password);
if (err) {
return callback(err);