Skip to content

Instantly share code, notes, and snippets.

rvm upgrade `rvm list strings | grep ruby-1.9.2` 1.9.2
[23/09/2011 16:46:55] Steve Woodcock: what's this aeropress coffee all about then?
[23/09/2011 16:55:07] Omar Qureshi: its like a big fuck off tube
[23/09/2011 16:55:38] Lydia Grove: Sometimes it seems a crime to me that Omar doesn't work in marketing
var mongoose = require('mongoose');
var _ = require('underscore');
var models = {}
var Schema = mongoose.Schema, ObjectId = Schema.ObjectId;
var TimestampProperties = {
created_at : Date,
updated_at : Date
}
var mongoose = require('mongoose');
var _ = require('underscore');
var models = {};
var Schema = mongoose.Schema, ObjectId = Schema.ObjectId;
var bcrypt = require('bcrypt');
var TimestampProperties = {
created_at : Date,
updated_at : Date
}
passenger-install-nginx-module --auto-download --auto
<?php
class Bcrypt
{
const DEFAULT_WORK_FACTOR = 8;
public static function hash($password, $work_factor = 0)
{
if (version_compare(PHP_VERSION, '5.3') < 0) throw new Exception('Bcrypt requires PHP 5.3 or above');
@omarqureshi
omarqureshi / friendship.rb
Created December 3, 2011 23:56
friendships_schema.sql
class Friendship < ActiveRecord::Base
belongs_to :user
belongs_to :friend, :class_name => "User"
validates_presence_of :friend_id
validates_presence_of :user_id
validates_inclusion_of :accepted, :in => [true, false]
validates_uniqueness_of :friend_id, :scope => [:user_id]
validate :unique_friendship_record, :cannot_be_own_friend
attr_accessible :user_id, :friend_id
@omarqureshi
omarqureshi / gist:1454009
Created December 10, 2011 00:36
automatic validations teaser!
require "auto_validate/version"
require "active_record"
# First run for this application will be JUST PostgreSQL, just as a
# proof of concept - currently all tests are running solely against
# 9.1, though a lot of this should work for anything over 8
#
#
# Reference for this class is at
# http://www.postgresql.org/docs/current/static/catalog-pg-constraint.html
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
function emacs() {
(/usr/local/bin/emacs $1 &)
}