Skip to content

Instantly share code, notes, and snippets.

View semikolon's full-sized avatar

Fredrik Bränström semikolon

View GitHub Profile
namespace :spec do
namespace :db do
namespace :fixtures do
desc 'Create YAML spec fixtures from data in an existing database. Defaults to development database. Set RAILS_ENV to override. You can also set tables to dump with rake spec:db:fixtures:dump TABLES=posts,pages'
task :dump => :environment do
sql = "SELECT * FROM %s"
skip_tables = ["schema_info", "schema_migrations"]
ActiveRecord::Base.establish_connection(RAILS_ENV)
fredrik@Benton ‣ svn co http://svn.ruby-lang.org/repos/ruby/tags/v1_8_6_111/ext/readline/ readline
A readline/depend
A readline/readline.c
A readline/README.ja
A readline/extconf.rb
A readline/.cvsignore
A readline/README
U readline
Checkade ut revision 20886.
fredrik@Benton ‣ readline ~/Code/RoR
class Project < ActiveRecord::Base
def self.find(*args)
options = args.extract_options!
if not options.include? :order
options[:order] = 'finished_at desc'
end
args.push(options)
super
end
@semikolon
semikolon / brew.pl
Created January 14, 2009 17:34 — forked from Yuffster/brew.pl
#!/usr/bin/env perl
#
# Copyright (c) 2009 Michelle Steigerwalt <msteigerwalt.com>
# All rights reserved.
#
# Handy-dandy tea brewing timer. Uses Growl for messaging.
#
# Normal Mode:
# > brew oolong
# Steeping for five minutes.
@semikolon
semikolon / brew.pl
Created January 14, 2009 17:38 — forked from Yuffster/brew.pl
#!/usr/bin/env perl
#
# Copyright (c) 2009 Michelle Steigerwalt <msteigerwalt.com>
# All rights reserved.
#
# Upgraded to metric system by Fredrik Bränström <branstrom.name>
#
# Handy-dandy tea brewing timer. Uses Growl for messaging.
#
# Normal Mode:
# in config/routes.rb
map.connect '', :controller => 'domain_tests', :action => 'domain1', :conditions => {:hostname => "domain1"}
map.connect '', :controller => 'domain_tests', :action => 'domain2', :conditions => {:hostname => "domain2"}
# in config/environment.rb after the initialize section
module ActionController
module Routing
class RouteSet
def extract_request_environment(request)
{ :method => request.method, :hostname => request.domain.split('.').first }
RE="ruby-enterprise-1.8.6-20081215"
PREFIX=/opt/$RE
VERSION=2.0.6
GEM_PATH="$PREFIX/lib/ruby/gems/1.8/gems/passenger-$VERSION"
DOMAIN=odpiralnicasi.com
APP_ROOT=/srv/oc
# install Apache2
apt-get install -qq apache2 apache2-prefork-dev
shared: &shared
# Use different adapters with JRuby vs. MRI
adapter: <%= defined?(JRuby) ? "jdbcmysql" : "mysql" %>
encoding: utf8
username: root
password:
host: localhost
socket: /opt/local/var/run/mysql5/mysqld.sock
<%
set theIP to do shell script "curl -sf http://checkip.dyndns.org/|cut -d ':' -f 2|cut -d '<' -f1|sed -e 's/ //g'"
tell application "LaunchBar"
display in large type theIP with title "External IP Address:"
end tell
return theIP
module Harmony
# Allows accessing config variables from harmony.yml like so:
# Harmony[:domain] => harmonyapp.com
def self.[](key)
unless @config
raw_config = File.read(RAILS_ROOT + "/config/harmony.yml")
@config = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
end
@config[key]
end