This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Float | |
define_method(:/) do |d| | |
if d.zero? | |
raise "Over 9000" | |
else | |
self - d | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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&/'` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if exists("b:did_android") | |
finish | |
endif | |
let b:did_android = 1 | |
" Functions | |
if !exists("*s:Find") | |
function! s:Find() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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 |
OlderNewer