Skip to content

Instantly share code, notes, and snippets.

View mike-burns's full-sized avatar
💭
GitLab

Mike Burns mike-burns

💭
GitLab
View GitHub Profile
require 'test_helper'
class OpenidsControllerTest < ActionController::TestCase
def setup
@openid_identity = Factory.next(:openid_identity)
end
should_route :get, '/openid', :controller => 'openids', :action => 'show'
should_route :put, '/openid', :controller => 'openids', :action => 'update'
class Float
define_method(:/) do |d|
if d.zero?
raise "Over 9000"
else
self - d
end
end
end
require 'test_helper'
class PostsTest < ActionController::IntegrationTest
def updating_a_post_successfully
user = Factory(:user)
i_am_signed_in_as(user)
post = Factory(:post, :user => user)
go_to(edit_post_path(post))
fill_in(:title, :with => 'Willard Scott')
@mike-burns
mike-burns / mig
Created December 10, 2010 19:23
Make a Rails migration file ASAP
#!/bin/sh
# make a migration file quickly
if [ "x$1" = "x" ]; then
echo "Usage: mig migration_name"
exit
else
migration_file_name="db/migrate/`date +%Y%m%d%H%M%S`_$1.rb"
class_name=`echo $1 | sed -e 's/_\(.\)/\U\1/g' -e 's/./\U&/'`
@mike-burns
mike-burns / gist:846287
Created February 27, 2011 16:10
~/.vim/ftplugin/java.vim
if exists("b:did_android")
finish
endif
let b:did_android = 1
" Functions
if !exists("*s:Find")
function! s:Find()
@mike-burns
mike-burns / gist:987910
Created May 24, 2011 00:05
Implicts in Ruby, via Scala
# Implicits in Ruby, based on Scala. Works like:
#
# implicitly.from(BaseClass).to(WrapperClass).via do |base_object|
# WrapperClass.new(base_object)
# end
#
def implicitly
Implicit.new
end
## agrep
# History grep, process grep
autoload hgrep pg
## android
export ANDROID_HOME=/usr/local/android-sdk-linux_86
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools
launch() {
# for example, com.thoughtbot.hoptoad/.ErrorsActivity'
@mike-burns
mike-burns / gist:1174060
Created August 26, 2011 18:26
shoulda-matchers failure
~/lib/shoulda-matchers% rake
(in /home/mike/lib/shoulda-matchers)
>> bundle install --gemfile=gemfiles/3.0.3.gemfile
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.6.0)
Using activemodel (3.0.3)
kitchen = SafeGrillDecorator.new(
:kitchen => ExposingDecorator.new(
:expose => [:strawberry_fluff,:peanut_butter, :bread, :knife],
:kitchen => UnsafeBareKitchen.new))
sandwich_maker = SandwichMaker.new
possible_sandwich = sandwich_maker.
collect_knife(kitchen).
with_that(:collect_bread).
% sudo apt-get install python-pip
% sudo pip install virtualenv
% cd argonaut
% virtualenv ENV
% source ENV/bin/activate
% wget -c http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.12/pygobject-2.12.3.tar.bz2 -O pygobject-2.12.3tar.bz2
% tar -xf pygobject-2.12.3tar.bz2
% cd pygobject-2.12.3tar.bz2
% ./configure --prefix=$VIRTUAL_ENV
% make