Skip to content

Instantly share code, notes, and snippets.

View adambair's full-sized avatar

Adam Bair adambair

View GitHub Profile
class AddExpiresAtToOffer < ActiveRecord::Migration
def change
add_column :offers, :expires_at, :date
Offer.reset_column_information
puts 'Setting expiration dates...'
Offer.find_each do |offer|
expiration_date = offer.created_at + 6.months
offer.update_column(:expires_at, expiration_date)
before_save :set_expiration_date
def expired?
expires_at > Time.now
end
def set_expiration_date
expires_at = Time.now + 6.months
end
@adambair
adambair / .tmux.conf
Created March 21, 2012 14:27 — forked from jondkinney/README.md
j2fly's vim setup, install with: exec 3<&1;bash <&3 <(curl https://raw.github.com/gist/2040114/vim.sh 2> /dev/null)
# Our .tmux.conf file
# Setting the prefix from C-b to C-a
# START:prefix
set -g prefix C-a
# END:prefix
# Free the original Ctrl-b prefix keybinding
# START:unbind
unbind C-b
@adambair
adambair / protip-tmux-radness
Created March 20, 2012 16:58 — forked from renaehodgkins/tmux-protip-radness
protip tmux radness
#protip add 'new-session' to your .tmux.conf -- then add 'tmux attach' to the end
of your .bashrc/.profile/.zshrc or whatever to automatically connect or
create a new session. It's fucking rad.
https://img.skitch.com/20120320-drb6wifhbmy3n2137s2chymrn1.jpg
@adambair
adambair / data.csv
Created December 12, 2011 16:14 — forked from clr/data.csv
Planet Finder RubyGames
Life DistanceWithin3AU TempUnder375 Water Atmosphere ClassM GasGiant
0 0 0 0 1 0 1
0 1 1 0 1 0 0
0 1 0 0 0 0 0
0 0 0 0 1 0 0
0 1 0 0 1 0 1
0 1 0 1 0 0 1
0 1 1 0 1 0 1
1 0 1 1 1 0 0
0 1 0 0 1 0 1

1. Achievement

Definition: A virtual or physical representation of having accomplished something. These are often viewed as rewards in and of themselves.

Example: a badge, a level, a reward, points, really anything defined as a reward can be a reward.

2. Appointment Dynamic

Definition: A dynamic in which to succeed, one must return at a predefined time to take some action. Appointment dynamics are often deeply related to interval based reward schedules or avoidance dyanmics.

@adambair
adambair / epic snow leopard upgrade guide.txt
Created September 3, 2009 13:44 — forked from edward/epic snow leopard upgrade guide.txt
Epic Snow Leopard Upgrayyyyd Guide
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness