Skip to content

Instantly share code, notes, and snippets.

View AndrewTerry's full-sized avatar

Andrew Terry AndrewTerry

  • UK
View GitHub Profile
@AndrewTerry
AndrewTerry / iTermRails.scpt
Created May 13, 2011 14:21
Applescript for creating tabbed iTerm session for Rails development
property railsFolder : "/Users/andrew/Documents/DevProjects/rails_projects/" --update this to reflect your own location
global targetProjectName
global railsProject
-- Creates a new tab with the command passed to it, and sets the title accordingly
on newTab(tabTitle, command)
tell application "iTerm" to tell first terminal
launch session "Default"
tell last session
write text "cd " & railsProject & command
@AndrewTerry
AndrewTerry / railsTutorial-user.rb
Created April 25, 2011 07:54
Why do I get "undefined method 'has_password?' for nil:NilClass" when I run my test?
require 'digest'
class User < ActiveRecord::Base
attr_accessor :password
attr_accessible :name, :email, :password, :password_confirmation
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :name, :presence => true,
:length => { :maximum => 50 }