Skip to content

Instantly share code, notes, and snippets.

View npverni's full-sized avatar

Nathan Verni npverni

  • Tropic
  • 56th and Wabasha
View GitHub Profile
namespace :ts do
desc "stop, index, start sphinx"
task :reboot => :environment do
Rake::Task['ts:stop'].invoke
Rake::Task['ts:in'].invoke
Rake::Task['ts:start'].invoke
end
end
alias subset='mate app config db/migrate/ doc lib/ public/javascripts/ public/stylesheets/ test vendor/plugins/ db/schema.rb'
@npverni
npverni / gist:176615
Created August 27, 2009 22:13
should_be_valid_with_factory macro for shoulda/factory_girl
class ActiveSupport::TestCase
self.use_transactional_fixtures = true
self.use_instantiated_fixtures = false
def self.should_be_valid_with_factory
klass = self.name.gsub(/Test$/, '').downcase.to_sym
should "be valid with factory" do
assert_valid Factory.build(klass)
end
@npverni
npverni / bootstrap_snowleopard.sh
Created August 31, 2009 20:42
Installs Ruby, Rails, RubyGems, MySQL and Git on Snow Leopard
cp ~/.profile ~/.profile.bak
echo 'export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"' > ~/.profile
. ~/.profile
echo 'Creating src directory'
mkdir ~/src
cd ~/src
echo 'Installing MySQL'
@npverni
npverni / get_addons.sh
Created August 31, 2009 23:27
Get the installers for Firefox, Adium and Textmate
curl -O http://mirror.informatik.uni-mannheim.de/pub/mirrors/mozilla.org/firefox/releases/3.5.2/mac/en-US/Firefox%203.5.2.dmg
curl -O http://adiumx.cachefly.net/Adium_1.3.6.dmg
curl -O http://download-b.macromates.com/TextMate_1.5.9.dmg
@npverni
npverni / gist:220041
Created October 27, 2009 22:44
bostonrb EventsControllerTest patch
From 13a321af86d47904670ea2c9ad8d49fed527c210 Mon Sep 17 00:00:00 2001
From: Nathan Verni <[email protected]>
Date: Tue, 27 Oct 2009 18:42:18 -0400
Subject: [PATCH] Updated expectation in EventsControllerTest to match the :rss > :atom redirect
---
test/functional/events_controller_test.rb | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/test/functional/events_controller_test.rb b/test/functional/events_controller_test.rb
@npverni
npverni / gist:221518
Created October 29, 2009 15:35
boston.rb: Test, Feature and code for Jobs Atom Feed
From ec7bf4201c54d03d603b47452a5da98659e99b8b Mon Sep 17 00:00:00 2001
From: Nathan Verni <[email protected]>
Date: Thu, 29 Oct 2009 11:28:05 -0400
Subject: [PATCH 1/2] Test, Feature and code for Jobs Atom Feed
---
app/views/jobs/index.atom.builder | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
create mode 100644 app/views/jobs/index.atom.builder
named_scope :featured, lambda {|*args|
limit = args.first || 1
{ :conditions => ['is_featured = 1'],
:order => 'start_date asc',
:limit => limit}
}
Steps to migrate a Rails 2.3 project to bundler.
1. Install bundler
gem install bundler
2. Remove existing vendor gems directory
rm -rf vendor/gems
require 'rubygems'
require 'chargify_api_ares'
Chargify.configure do |c|
c.subdomain = ''
c.api_key = ''
end
customer = Chargify::Customer.create(