Skip to content

Instantly share code, notes, and snippets.

View schlick's full-sized avatar

Michael MacDonald schlick

View GitHub Profile
@therobot
therobot / gist:102770
Created April 27, 2009 22:06
Rolls back database to migration level of the previously deployed release
before "deploy:rollback:revision", "deploy:rollback_database"
desc "Rolls back database to migration level of the previously deployed release"
task :rollback_database, :roles => :db, :only => { :primary => true } do
if releases.length < 2
abort "could not rollback the code because there is no prior release"
else
rake = fetch(:rake, "rake")
rails_env = fetch(:rails_env, "production")
migrate_env = fetch(:migrate_env, "")
~$ ARCHFLAGS='-arch i386 -arch x86_64'
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download
~$ tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0
~/RubyCocoa-1.0.0$ ruby install.rb config --build-universal=yes
~/RubyCocoa-1.0.0$ ruby install.rb setup
~/RubyCocoa-1.0.0$ sudo ruby install.rb install
@pat
pat / And here's how.textile
Created October 19, 2010 03:12
Access Level Highlighting

Access Level Highlighting

You’ll want to put these files in ~/Library/Application Support/TextMate/Themes – they will override the built-in versions of each. There’s almost no difference – just the access level matcher. From there, restart TextMate, and you should have a new element listing in the Fonts & Colors tab in your TextMate preferences.

Next, you want to add the actual syntax definition – open up the Bundle Editor in TextMate, and then the Ruby Language definition within that. Search for “variable.language.ruby” – and then add the following below that:

{
  name = 'access-level.ruby';
  comment = ' public, private, protected';
  match = '^[ ]*\b(private|protected|public)\b(?![?!])\n';
@ltw
ltw / best_model.rb
Created February 21, 2011 01:29
Order of a standard Model
class Model < ParentModel
include Foo::Bar
extend Bar::Baz
acts_as_authentic
dsl_specific_flags
module InternalModule
...
end
<ul>
<% User.all.with_item_counts do |user| %>
<li><%= user.username %> - Items: <%= user.calculated_item_count %>
<% end %>
</ul>
@jlindley
jlindley / config.ru
Created April 18, 2011 17:03
Rails 2.3.x config.ru (to allow using http://pow.cx/ )
require "./config/environment"
use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new
module Resque
class Task
attr_accessor :parent, :args
attr_accessor :queue, :failed_at, :payload, :exception, :error, :backtrace, :worker
def initialize(options={})
options['parent'] = options.delete('class')
options.each do |opt, val|
self.send("#{opt}=", val)
end
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@stigkj
stigkj / git-fix-author
Created December 9, 2011 11:13 — forked from leif81/git_fix_author
Written to change the unix name used for a cvs commit to a pretty git name for the user.Implementation borrowed from http://lists.freedesktop.org/archives/portland/2010-October.txtauthor-conv-file format (same format as git-cvsimport requires):
#!/bin/bash
#
# Changes author and committer name and email throughout the whole repository.
# Uses a file with the following format:
#
# john.doe@hotmail.com=John Doe <john.doe@hotmail.com>
# jill.doe@hotmail.com=Jill Doe <jill.doe@hotmail.com>
#
if [ ! -e "$1" ]
@schlick
schlick / best_model.rb
Last active September 30, 2015 01:57 — forked from ltw/best_model.rb
Order of a standard Model
class Model < ParentModel
include Foo::Bar
extend Bar::Baz
acts_as_authentic
dsl_specific_flags
module InternalModule
...
end