This file contains 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 << params_hash | |
def to_params | |
inject([]) do |a,v| | |
if v[1] | |
a << "'#{v[0].to_s}=#{v[1]}'" | |
end | |
a | |
end.join("&") | |
end | |
end |
This file contains 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
<%- @recent_news.each do |a| -%> | |
<h3><%= link_to_channels_resource @channel, "news", "view", a, a.subject %></h3> | |
<p><%= truncate a.content_text, 200 %> <%= link_to_channels_resource @channel, "news", "view", a, "more >" %></p> | |
<% unless a == @recent_news.last %> | |
<hr> | |
<% end %> | |
<%- end -%> |
This file contains 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/bash | |
cd ~/code/projects/within3 | |
CUR_BRANCH=`git branch | grep "*" | cut -d " " -f2` | |
git checkout mainline | |
git svn rebase 2> ~/scripts/output.txt | |
qs ~/scripts/output.txt | |
git checkout $CUR_BRANCH |
This file contains 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
has_behavior :supports_groups_and_categories | |
def has_behavior(behavior) | |
mod = behavior.to_s.camelize.constantize | |
class << mod | |
def class_methods | |
mod::ClassMethods | |
end | |
def instance_methods | |
mod::InstanceMethods |
This file contains 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
syntax on | |
colorscheme dimgrey | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
set smarttab | |
set softtabstop=2 | |
set autoindent | |
set nocompatible | |
set number |
This file contains 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
======================================================= BAD | |
Scenario: User selects a group on the news widget | |
Given there are articles for each group | |
When I select a group | |
Then the news list should display news for the group I selected | |
======================================================= BAD | |
Scenario: User selects the BDD group | |
Given there are 4 articles in the BDD group | |
When I select the BDD group |
This file contains 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
" These commands MUST go in your .gvimrc otherwise it will not work! | |
" Found at http://www.nabble.com/Mapping-%EF%A3%BF%2BT--td20023721.html | |
macmenu &File.New\ Tab key=<nop> | |
nnoremap <D-t> :FuzzyFinderTextMate<cr> |
This file contains 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
describe "handling GET /groups/not_found.xml 404" do | |
def do_get | |
request.env["HTTP_ACCEPT"] = "application/xml" | |
get :show, :id => "not_found" | |
end | |
it "should 404 if given group that doesn't exist" do | |
Group.stub!(:find_by_permalink!).and_return(nil) | |
do_get |
This file contains 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 InternetEnabledPersonForgery < NameForgery | |
dictionaries :top_level_domains | |
def self.last_name | |
@@current_last_name = LAST_NAMES.random | |
end | |
def self.first_name | |
@@current_first_name = [MALE_FIRST_NAMES, FEMALE_FIRST_NAMES].random.random | |
end |
This file contains 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 'rubygems' | |
require 'spec' | |
class Person | |
attr_accessor :name | |
attr_accessor :shoe_size | |
def eat(sandwich) | |
sandwich.cut_in_half | |
sandwich.eaten = true |