Skip to content

Instantly share code, notes, and snippets.

View cmeiklejohn's full-sized avatar
💭
Always working.

Christopher S. Meiklejohn cmeiklejohn

💭
Always working.
View GitHub Profile
@cmeiklejohn
cmeiklejohn / mountain-lion-brew-setup.markdown
Created July 25, 2012 23:29 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@cmeiklejohn
cmeiklejohn / rbenv-install-system-wide.sh
Created November 22, 2011 04:59
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@cmeiklejohn
cmeiklejohn / person_test.rb
Created October 5, 2011 20:28 — forked from vamsee/person_test.rb
Use minitest/spec with Rails 3
require 'test_helper'
require 'minitest/autorun'
module Tenderlove
class Spec < MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActiveRecord::TestFixtures
alias :method_name :__name__ if defined? :__name__
self.fixture_path = File.join(Rails.root, 'test', 'fixtures')
#http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/
describe User do
subject { user }
let(:user) { User.new }
context "when name empty" do
it { should_not be_valid }
specify { user.save.should be_false }
end
@cmeiklejohn
cmeiklejohn / en.yml
Created September 27, 2011 20:51 — forked from chrisbloom7/README.md
A cheap knock off of the default validates_length_of validator, but checks the filesize of a Carrierwave attachment
# config/locales/en.yml
en:
errors:
messages:
wrong_size: "is the wrong size (should be %{file_size})"
size_too_small: "is too small (should be at least %{file_size})"
size_too_big: "is too big (should be at most %{file_size})"
@cmeiklejohn
cmeiklejohn / person_test.rb
Created September 20, 2011 20:57 — forked from tenderlove/person_test.rb
Use minitest/spec with Rails 3
require 'test_helper'
require 'minitest/autorun'
module Tenderlove
class Spec < MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActiveRecord::TestFixtures
alias :method_name :__name__ if defined? :__name__
self.fixture_path = File.join(Rails.root, 'test', 'fixtures')
.--.-.
( ( )__
(_, \ ) ,_) |
'-'--`--' ~~| , \ _ /
,|`-._/| -== (_) ==-
^^ .' | /||\ / \
^^ .' | ./ ||`\ |
/ `-. |/._ || \
/ `|| `|;-._\
@cmeiklejohn
cmeiklejohn / Questions
Created August 9, 2011 00:52
Frozen Rails Give-away
Day job: Software Engineer at Swipely
Your Rails contributions (if any): Around six or so bug fixes to rails. Have also fixed bugs in a bunch of other gems. Recent contributor to rubygems.org.
What's your Ruby/Rails experience?: Been working with rails off and on since around 2006. Full time Rails developer currently.
How do you use GitHub?: All of my source code, dotfiles, projects in progress, contributing to other projects.
@cmeiklejohn
cmeiklejohn / utf8_header.rb
Created April 24, 2011 00:38 — forked from derencius/utf8_header.rb
thor file to add utf-8 header on ruby files. useful for converting ruby 1.8 projects to 1.9
class Utf8Header < Thor
desc "add", "Add Content UTF-8 on top of all .rb/.feature files"
# copy & pasted from https://gist.github.com/738245
def add
files = Array.new
["*.rb", "*.rake","*.feature"].each do |extension|
files.concat(Dir[ File.join(Dir.getwd.split(/\\/), "**", extension) ])
end
files.each do |file|
class MicropostsController < ApplicationController
before_filter :set_micropost, :only => [:show, :edit, :update, :create, :new]
before_filter :authenticate, :only => [:create, :destroy] # Same here?
# Omitted.
def destroy
@micropost.destroy
redirect_back_or root_path