Skip to content

Instantly share code, notes, and snippets.

View lukeredpath's full-sized avatar
🏠
Working from home

Luke Redpath lukeredpath

🏠
Working from home
View GitHub Profile
def show
if @project = @user.projects.find_by_name(params[:project_name])
# congrats, it exists
elsif project = @user.projects.find_by_old_name(params[:project_name])
redirect_to project_url(project), :status => :moved_permanently
end
end
def show
if @project = @user.projects.find_by_name(params[:project_name])
# congrats, it exists
elsif project = @user.projects.find_by_old_name(params[:project_name])
redirect_to project_url(project), :status => :moved_permanently
end
end
@lukeredpath
lukeredpath / Delayed::Job daemon script for delayed_job
Created January 29, 2009 19:13
An easy way to take the effort out of managing your background worker process is to write a simple wrapper script using the *daemons* gem.
#!/usr/bin/env ruby
require 'rubygems'
require 'daemons'
dir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
daemon_options = {
:multiple => false,
:dir_mode => :normal,
:dir => File.join(dir, 'tmp', 'pids'),
:backtrace => true
#!/usr/bin/env ruby
require 'fileutils'
if ARGV.empty?
puts "Usage: #{__FILE__} <repository> <repository> ..."
exit -1
end
created_flags = []
require 'rubygems'
require 'activerecord'
require 'builder'
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:host => 'localhost',
:database => 'mephisto'
)
--- makefile.osx.orig 2009-02-26 23:41:13.000000000 +0000
+++ makefile.osx 2009-02-26 23:41:15.000000000 +0000
@@ -3,7 +3,7 @@
#CFLAGS=-Wall -DSLIMPROTO_DEBUG -D__BIG_ENDIAN__
CFLAGS=-Wall -DSLIMPROTO_DEBUG
-INCLUDE=-Ilib/portaudio/pa_common -Ilib/portaudio/pablio -Ilib/portmixer/px_common -Isrc
+INCLUDE=-Ilib/portaudio/pa_common -Ilib/portaudio/pablio -Ilib/portmixer/px_common -Isrc -I/opt/local/include
PORTAUDIOFILES:=lib/portaudio/pa_mac_core/pa_mac_core.c lib/portaudio/pa_common/pa_lib.c lib/portaudio/pa_common/pa_convert.c lib/portaudio/pablio/ringbuffer.c
class Array
def move_to_front_of_line(x)
unshift(delete(self[x]))
end
end
class Tag
has_many :taggings
end
class Tagging
belongs_to :tag
belongs_to :posts
# uses a string 'flag' column but could be changed to a boolean important
# column later, hence the need to encapsulate!
From b7894c95720d13ec7d955fb3675294db5aedf987 Mon Sep 17 00:00:00 2001
From: Luke Redpath <contact@lukeredpath.co.uk>
Date: Fri, 27 Feb 2009 17:35:41 +0000
Subject: [PATCH] Initial attempt at adding a :scope option to has_many :through.
This allows you to have has_many :through collections that go
through a named scope on your join model. This should make it
clearer: http://gist.github.com/71585
---
activerecord/lib/active_record/associations.rb | 3 ++-
RELEASE_OUTPUT_PATH = File.expand_path("~/Projects/releases/Squeemote")
TARGET_NAME = "Squeemote"
CONFIGURATION = ENV['CONFIGURATION'] || "Distribution"
SDK_VERSION = ENV['SDK'] || 'iphoneos2.2'
task :release do
puts "* Bumping build version."
`agvtool bump -all`
puts "* Building #{CONFIGURATION} release."