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
module LayoutHelper | |
def page_description | |
begin | |
vars = [:@question, :@user, :@topic, :@tribe, :@challenge, :@product] | |
dumps = Hash[*(vars.map{|v| [v, instance_variable_get(v).inspect]}.flatten)] | |
description = case | |
when @question then @question.background | |
when @user && @user.bio.present? then @user.bio | |
when @user && @user.sports.present? then @user.sports_list |
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 'guard/guard' | |
guard 'bundler' do | |
watch('Gemfile') | |
end | |
guard 'spork', :wait => 60, :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do | |
watch('config/application.rb') | |
watch('config/environment.rb') | |
watch(%r{^config/environments/.+\.rb$}) |
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
$ curl -v -H 'Accept: application/vnd.tribesports.api.v1+json' "http://tribesports.dev/activities/32006" | |
* About to connect() to tribesports.dev port 80 (#0) | |
* Trying 127.0.0.1... connected | |
* Connected to tribesports.dev (127.0.0.1) port 80 (#0) | |
> GET /activities/32006 HTTP/1.1 | |
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3 | |
> Host: tribesports.dev | |
> Accept: application/vnd.tribesports.api.v1+json | |
> | |
< HTTP/1.1 200 OK |
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
@search | |
Scenario: List products | |
Given the system has the following products: | |
| id | name | | |
| 1 | Acme Flaming Hammer | | |
| 2 | Adidas Patented Truss | | |
| 3 | Corby Trouser Press | | |
And I authenticate as admin | |
And I send and accept XML | |
And the search index is updated |
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 | |
echo -e "\x1B[0mCOLOR_NC (No color)" | |
echo -e "\x1B[1;37mCOLOR_WHITE\t\x1B[0;30mCOLOR_BLACK" | |
echo -e "\x1B[0;34mCOLOR_BLUE\t\x1B[1;34mCOLOR_LIGHT_BLUE" | |
echo -e "\x1B[0;32mCOLOR_GREEN\t\x1B[1;32mCOLOR_LIGHT_GREEN" | |
echo -e "\x1B[0;36mCOLOR_CYAN\t\x1B[1;36mCOLOR_LIGHT_CYAN" | |
echo -e "\x1B[0;31mCOLOR_RED\t\x1B[1;31mCOLOR_LIGHT_RED" | |
echo -e "\x1B[0;35mCOLOR_PURPLE\t\x1B[1;35mCOLOR_LIGHT_PURPLE" | |
echo -e "\x1B[0;33mCOLOR_YELLOW\t\x1B[1;33mCOLOR_LIGHT_YELLOW" | |
echo -e "\x1B[1;30mCOLOR_GRAY\t\x1B[0;37mCOLOR_LIGHT_GRAY" |
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 Brand < ActiveRecord::Base | |
validates_with BrandValidator | |
# ... | |
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 | |
files=`find . -name "_*.haml" -or -name "*_helper.rb" -or -name "_*.erb"` | |
count=`egrep -o @ $files | wc -l` | |
echo "$count kittens cried because of this code" |
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
--- github.com (207.97.227.239) ping statistics --- | |
100 packets transmitted, 68 packets received, 32.0% packet loss | |
round-trip min/avg/max/stddev = 88.800/123.325/383.601/52.514 ms | |
traceroute to github.com (207.97.227.239), 64 hops max, 52 byte packets | |
1 my.router (192.168.1.1) 2.774 ms 0.703 ms 0.691 ms | |
2 * * * | |
3 10.1.2.161 (10.1.2.161) 58.359 ms 15.083 ms 17.369 ms | |
4 linx1-lond-thn.virtual1.co.uk (195.66.224.109) 16.321 ms 13.685 ms * | |
5 79.98.160.100 (79.98.160.100) 34.895 ms |
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 | |
set -e | |
project=$1 | |
if [ -n "$2" ]; then | |
session_name=$2 | |
else | |
session_name=$1 | |
fi | |
directory="${HOME}/dev/${project}" |
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 A | |
attr_reader :fish | |
attr_writer :fish | |
private :fish= | |
def set_fish | |
fish = :carp | |
nil | |
end | |
end |