Skip to content

Instantly share code, notes, and snippets.

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
<%- @recent_news.each do |a| -%>
<h3><%= link_to_channels_resource @channel, "news", "view", a, a.subject %></h3>
<p><%= truncate a.content_text, 200 %>&nbsp;<%= link_to_channels_resource @channel, "news", "view", a, "more &gt;" %></p>
<% unless a == @recent_news.last %>
<hr>
<% end %>
<%- end -%>
#!/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
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
syntax on
colorscheme dimgrey
set tabstop=2
set shiftwidth=2
set expandtab
set smarttab
set softtabstop=2
set autoindent
set nocompatible
set number
======================================================= 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
" 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>
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
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
require 'rubygems'
require 'spec'
class Person
attr_accessor :name
attr_accessor :shoe_size
def eat(sandwich)
sandwich.cut_in_half
sandwich.eaten = true