Skip to content

Instantly share code, notes, and snippets.

View ariejan's full-sized avatar

Ariejan de Vroom ariejan

View GitHub Profile
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/robots.txt"
run "rm -f public/javascripts/*"
def get_random_number
return 4 //chosen by fair dice roll.
//guaranteed to be random.
end
@ariejan
ariejan / image_updater.rb
Created February 11, 2009 14:19
Easily update generated thumbnails for file_column
# recreates all file_column images in all needed sizes
class ImageUpdater
def update_all
update_model(:video, :image)
update_model(:photo, :image)
end
private
Second line in view:
Expected: /artikelen/frontpage/123
Got: /articles/123?section_slug=frontpage
/* -------------------------------------------------------------------------------------------------
It's *strongly* suggested that you don't modify this file. Instead, load a new stylesheet after
this one in your layouts (eg formtastic_changes.css) and override the styles to suit your needs.
This will allow you to update formtastic.css with new releases without clobbering your own changes.
This stylesheet forms part of the Formtastic Rails Plugin
(c) 2008 Justin French
--------------------------------------------------------------------------------------------------*/
%! program = pdflatex
\documentclass[9pt,twoside,pageany]{memoir}
% Sets the papersize.
% \settrimmedsize{4.25in}{6.875in}{*}
% Sets the papersize.
\setstocksize{17.463cm}{10.795cm}
# Use ApiKey.generate to generate a new API key
class ApiKey < ActiveRecord::Base
validates_presence_of :key
validates_uniqueness_of :key
def self.generate(description = "No description")
key = Digest::SHA1.hexdigest("--#{Time.now}--#{description}--")
ApiKey.create(:description => description, :key => key)
end
# This little nugget will remove an existing rake task. This allows you to
# redefine tasks.
#
# remove_task :test
# task :test => [:spec, :features]
#
Rake::TaskManager.class_eval do
def remove_task(task_name)
@tasks.delete(task_name.to_s)
end
@ariejan
ariejan / README
Created August 28, 2009 08:44
Easily report app version and revision numbers.
You must be using git and capistrano to deploy your app. Capistrano will place a file in your Rails.root named 'REVISION'. Tested with the following capistrano setting:
set :scm, :git
set :deploy_via, :remote_cache
@ariejan
ariejan / template.rb
Created September 4, 2009 21:51
Rails 2.3.x template
# This Rails 2.3.x template will create a new git-based Rails project
# with Cucumber, RSpec and Remarkable pre-installed and ready to go.
#
# (C) 2009 under the MIT License by Ariejan de Vroom <[email protected]>
#
# USAGE:
# rails -d mysql -m http://gist.github.com/181167.txt APP_NAME
# Delete unnecessary files