Skip to content

Instantly share code, notes, and snippets.

View dstrelau's full-sized avatar

Dean Strelau dstrelau

View GitHub Profile
[~] gem i mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/Users/dstrelau/.rvm/ruby-enterprise-1.8.7-20090928/bin/ruby extconf.rb
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
#!/bin/sh
NAME=nginx
DESC=nginx
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/nginx
DAEMON_ARGS=""
CONFIG=/etc/nginx/nginx.conf
PID_FILE="/var/run/${NAME}.pid"
[~] gem env
RubyGems Environment:
- GEM PATHS:
- /Users/dstrelau/.gem/ruby/1.8.7
- /Users/dstrelau/.gem/ruby/1.8
- /Users/dstrelau/.rvm/ruby-1.8.7-p174/lib/ruby/gems/1.8
[~] rvm use 1.8.7
[~] gem env
RubyGems Environment:
- GEM PATHS:
[~] rvm install 1.8.6 -d
++ which curl
+ rvm_curl=/usr/bin/curl
+ '[' 0 -ne 0 ']'
+ rvm_curl='/usr/bin/curl -O -L -s'
+ '[' -z '' -a -z 1.8.6 ']'
+ rvm_implementation=ruby
+ niceness=0
++ whoami
+ '[' dstrelau = root ']'
$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.8.0]
$ rake -v
(in /Users/dstrelau/proj)
/Users/dstrelau/.rvm/ruby-1.8.6-p369/bin/ruby -I"lib:test"
[...]
@dstrelau
dstrelau / user.rb
Created July 8, 2009 21:34
contexts for active record validations
class User < ActiveRecord::Base
include ValidationContexts
validation_context :default, :signup do
validates_uniqueness_of :email, :allow_blank => true
validates_presence_of :email
end
validation_context :signup do
validates_confirmation_of :password
@dstrelau
dstrelau / configurable.rb
Created June 17, 2009 20:38
Configurable - make any object configurable
require 'ostruct'
module Configurable
def config
@config ||= OpenStruct.new
yield @config if block_given?
end
def respond_to?(sym)
@config.respond_to?(sym) || super(sym)
end
@dstrelau
dstrelau / config.ru
Created March 26, 2009 21:16
Basic Hoptoad Notifier as Rack Middleware
require 'rack/hoptoad_notifier'
use Rack::HoptoadNotifier do |config|
config[:api_key] = 'XXXXXXXX'
end
== 0. Create and checkout local development branch
You've probably done this already.
git checkout master # now on master
git checkout -b development origin/development # track remote dev branch
== 1. Adding features for bug 12000
This is optional, but highly encouraged. You can just develop right on your
@dstrelau
dstrelau / backup_user.sql
Created February 20, 2009 16:58
mysql backups with duplicity
CREATE USER 'backup'@'localhost';
GRANT SELECT, LOCK TABLES ON *.* TO 'backup'@'localhost';