Skip to content

Instantly share code, notes, and snippets.

var models = require('./models');
models.synchronize();
@sdepold
sdepold / gist:3205975
Created July 30, 2012 10:06
missing context in nested describe's tests when using beforeAll
var buster = require('buster')
buster.spec.expose()
describe('Outer', function() {
beforeAll(function() {
this.foo = 1
console.log('outer beforeAll', this.foo)
})
@sdepold
sdepold / gist:3168560
Created July 24, 2012 07:22
phonononono
var User = sequelize.import(__dirname + '/../models/User.js');
var Phone = sequelize.import(__dirname + '/../models/Phone.js');
Phone.hasOne(User,{ foreignKey: 'Phone_id'});
Phone.findAll().success(function(phones){
phones.forEach(function(phone) {
phone.getUser().success(function(user){
console.log(phone.Name, user.Extension);
});
NameVirtualHost *:80
<VirtualHost *:80>
ServerName busterrrrr.com
ServerAdmin admin@busterrrrr.com
ProxyRequests On
ProxyPreserveHost On
ProxyStatus On
<Location />
@sdepold
sdepold / gist:3070500
Created July 8, 2012 10:55
buster-dev
sdepold:~/Projects/buster-dev ∴ ls -ila
total 0
26250376 drwxr-xr-x 31 sdepold staff 1054 8 Jul 08:39 .
500726 drwxr-xr-x 42 sdepold staff 1428 7 Jul 09:53 ..
26292909 drwxr-xr-x 18 sdepold staff 612 8 Jul 08:52 buster
26289731 drwxr-xr-x 12 sdepold staff 408 8 Jul 08:40 buster-analyzer
26289945 drwxr-xr-x 19 sdepold staff 646 8 Jul 08:40 buster-assertions
26290596 drwxr-xr-x 11 sdepold staff 374 8 Jul 08:51 buster-autotest
26291618 drwxr-xr-x 15 sdepold staff 510 8 Jul 08:40 buster-capture-server
26292357 drwxr-xr-x 13 sdepold staff 442 8 Jul 08:40 buster-cli
@sdepold
sdepold / gist:3040391
Created July 3, 2012 15:17
associations in sequelize
var Sequelize = require('sequelize')
, sequelize = new Sequelize('sequelize_test', 'root', null, {
logging: false
})
var Project = sequelize.define('project', {
name: Sequelize.STRING
})
var Task = sequelize.define('task', {
@sdepold
sdepold / buster.js
Created June 29, 2012 10:36
equality check for arrays with prototype 1.6
var config = module.exports
config["node tests"] = {
tests: [
"*.spec.js"
],
environment: "node"
}
config["browser tests"] = {
@sdepold
sdepold / gist:2958440
Created June 20, 2012 06:36
"virtual fields" in sequelize
var Sequelize = require('sequelize')
var sequelize = new Sequelize('sequelize_test', 'root')
var Person = sequelize.define('Person', {
firstName: Sequelize.STRING,
lastName: Sequelize.STRING
}, {
instanceMethods: {
getFullName: function() {
return [this.firstName, this.lastName].join(' ')
@sdepold
sdepold / gist:2648051
Created May 9, 2012 19:04
private/public in js
Layout.ScrumBoard = (function() {
"use strict"
var ScrumBoard = function() {
}
ScrumBoard.prototype.render = function() {
getActivities.call(this, function(data) {
console.log(data)
@sdepold
sdepold / gist:2507049
Created April 27, 2012 07:41
category migration script cc @sdepold
puts "!! unique-ifying category names"
mk_unique = lambda{ |c| c.update_attribute(:name, c.name + rand(8**16).to_s(36)); print "." }
Category.all.each{ |c| mk_unique[c] if c.name.empty? || (Category.find_all_by_name(c.name).size > 1) }; nil
puts "\n\n!! migrating gettext keys"
mk_migrate = lambda{ |c, gk| gk.update_attribute(:accesskey, "category.#{c.name.to_slug}"); print "." }
Category.all.each{ |c| (gk = GettextKey.find_by_accesskey("category.#{c.id}")) ? mk_migrate[c, gk] : print("X") }; nil