Skip to content

Instantly share code, notes, and snippets.

@geoffgarside
geoffgarside / test.css
Created July 23, 2008 15:59
Trying to get a columnar list with CSS
form label {
display: inline-block;
line-height: 1.8;
vertical-align: top;
width: 11em; }
form label.required:after {
content: "*";
color: red; }
form fieldset {
margin-bottom: 10px;
Given a background image and RSS feed titles from the RSS feed will be overlaid on the background image.
This code is in the Public Domain.
Originally developed at http://forum.osnn.net/showthread.php?t=52418
class Accuracy < ActiveRecord::Base
belongs_to :measurable, :polymorphic => true
end
class Organisation < ActiveRecord::Base
has_one :accuracy, :as => :measurable
end
class CreateAccuracies < ActiveRecord::Migration
def self.up
<?php
// Encryption Routines
define('ENCRYPTION_KEY', 'artofwar');
define('ENCRYPTION_ALGORITHM', 'rijndael-256');
define('ENCRYPTION_MODE', 'ecb');
define('ENCRYPTION_IV_SOURCE', MCRYPT_DEV_RANDOM); // Change to MCRYPT_RAND if Windows
define('MYCRYPT_ENC', 1);
define('MYCRYPT_DEC', 2);
module Numerology
Standard = {
'1' => 1, '4' => 4, '7' => 7,
'2' => 2, '5' => 5, '8' => 8,
'3' => 3, '6' => 6, '9' => 9,
'A' => 1, 'J' => 1, 'S' => 1,
'B' => 2, 'K' => 2, 'T' => 2,
'C' => 3, 'L' => 3, 'U' => 3,
'D' => 4, 'M' => 4, 'V' => 4,
'E' => 5, 'N' => 5, 'W' => 5,
@geoffgarside
geoffgarside / gist:12154
Created September 22, 2008 20:35
Ruby Easter Calculation
def easter
y = Time.now.year
c = y / 100
n = y - 19 * ( y / 19 )
k = ( c - 17 ) / 25
i = c - c / 4 - ( c - k ) / 3 + 19 * n + 15
i = i - 30 * ( i / 30 )
i = i - ( i / 28 ) * ( 1 - ( i / 28 ) * ( 29 / ( i + 1 ) ) * ( ( 21 - n ) / 11 ) )
j = y + y / 4 + i + 2 - c + c / 4
j = j - 7 * ( j / 7 )
require 'rubygems'
require 'chronic'
require 'activesupport'
class BankHoliday
def self.include?(date)
@@holidays.include?(date.utc.beginning_of_day)
end
def self.next_from(date)
# Put this into your app/helpers directory and provided
# you have `helper :all` in your app/controllers/application.rb
# it will be automatically included, otherwise include it
# into app/helpers/application_helper.rb or wherever you
# want to use it.
module JavascriptHelper
# Use in your application layout like
# - yield_javascript_onready
# couldn't be simpler.
def yield_javascript_onready
module ActionView
module Helpers
class FormBuilder
def submits(create_value = "Create", update_value = "Update", options = {})
value = @object.new_record? ? create_value : update_value
submit(value, options)
end
end
end
end
Xcode
http://developer.apple.com/technology/xcode.html
[OR]
Mac OS X install disc 2
GNU wget
http://ftp.gnu.org/gnu/wget/wget-latest.tar.gz
Git
http://code.google.com/p/git-osx-installer/