Skip to content

Instantly share code, notes, and snippets.

" Vim color file
" Converted from Textmate theme Sunburst using Coloration v0.2.2 (http://github.com/sickill/coloration)
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
padrino rake spec -e test
=> Executing Rake spec ...
=> Located unlocked Gemfile for test
PostsController
- should be successful
Account Model
- can be created (FAILED - 1)
@emachnic
emachnic / application.haml
Created February 1, 2011 16:52
Refactoring 'if' statements in RubyFreelancers
/ Before refactoring
#freelancer_nav
- if freelancer_signed_in?
= link_to "Dashboard", '/freelancers/dashboard'
- if current_freelancer.profile.nil?
= link_to "New Profile", new_profile_path
- else
= link_to "My Profile", current_freelancer.profile
= link_to "Sign out", destroy_freelancer_session_path
- elsif admin_signed_in?
@emachnic
emachnic / Showoff 1.9.2 Stack Trace
Created March 6, 2011 04:40
Can't get Showoff to work using Ruby 1.9.2
Evan-Machnics-MacBook-Pro:showoff-wrangling-git evan$ showoff serve
== Sinatra/1.1.3 has taken the stage on 9090 for development with backup from WEBrick
[2011-03-05 23:38:03] INFO WEBrick 1.3.1
[2011-03-05 23:38:03] INFO ruby 1.9.2 (2011-02-18) [x86_64-darwin10.7.1]
[2011-03-05 23:38:03] INFO WEBrick::HTTPServer#start: pid=2553 port=9090
/Users/evan/.rvm/gems/ruby-1.9.2-p180/gems/showoff-0.3.4
/Users/evan/RailsApps/showoff-wrangling-git
127.0.0.1 - - [05/Mar/2011 23:38:09] "GET / HTTP/1.1" 200 2652 0.0251
practivate.adobe.com - - [05/Mar/2011:23:38:09 EST] "GET / HTTP/1.1" 200 2652
- -> /
@emachnic
emachnic / ActiveMerchant Mongoid
Created March 25, 2011 15:37
Trying to create a Mongoid document from params received through ActiveMerchant
class Donation
include Mongoid::Document
field :success, :type => String
field :authorization, :type => String
field :message, :type => String
field :params, :type => Hash, :default => {}
def response=(response)
self.success = response.success?
self.authorization = response.authorization
@emachnic
emachnic / gist:966335
Created May 11, 2011 12:01
RSpec/Capybara Error
1) user signs in should be successful
Failure/Error: page.body.should =~ "Successfully"
Rack::Test::Error:
No response yet. Request a page first.
# ./spec/integration/user_logs_in.rb:12:in `block (2 levels) in <top (required)>'
Finished in 0.44836 seconds
1 example, 1 failure
Ruby version 1.9.2p180, Rails version 3.1.0.beta1, RSpec version 2.6.0.rc6, Capybara version 0.4.1.2
@emachnic
emachnic / capygration_outline.md
Created May 18, 2011 13:14
Outline for Capygration Screencast

Capygration - Integration Testing Using Capybara and RSpec

Introduction, Assumptions, Problem, & Solution - Slides

  1. This screencast is for beginning Rails developers but will benefit seasoned veterans
  2. Cucumber is getting the hype lately because of it's syntax (show Gherkin syntax). Nice syntax comes with a lot of overhead (show file tree to manage feature).
  3. Wouldn't it be nice to get great syntax in integration tests and only have
@emachnic
emachnic / gist:1124529
Created August 4, 2011 04:59
r:UTF-8 Error
Started GET "/" for 68.35.219.53 at Wed Aug 03 21:56:34 -0700 2011
Processing by WelcomeController#index as HTML
Rendered welcome/index.html.erb within layouts/application (5.1ms)
Compiled app/assets/stylesheets/application.css (30ms) (pid 31512)
Compiled app/assets/stylesheets/blueprint/ie.css (0ms) (pid 31512)
Compiled app/assets/stylesheets/blueprint/plugins/buttons/screen.css (0ms) (pid 31512)
Compiled app/assets/stylesheets/blueprint/plugins/fancy-type/screen.css (0ms) (pid 31512)
Compiled app/assets/stylesheets/blueprint/plugins/link-icons/screen.css (0ms) (pid 31512)
Compiled app/assets/stylesheets/blueprint/plugins/rtl/screen.css (0ms) (pid 31512)
Compiled app/assets/stylesheets/blueprint/print.css (0ms) (pid 31512)
@emachnic
emachnic / nginx_virtual_host
Created November 27, 2011 05:37 — forked from mrsweaters/nginx_virtual_host
Ruby on Rails server setup on Ubuntu 11.04 with Nginx, Unicorn, Rbenv
upstream example-workers {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a single worker for timing out).
server unix:/tmp/example.co.uk.socket fail_timeout=0;
}
server {
listen 80; # default;
server_name example.co.uk;
root /home/example.co.uk/website/public;
@emachnic
emachnic / default.rb
Created December 1, 2011 15:29
Chef recipe to write redis.yml on Engine Yard Cloud
# ey-cloud-recipes/cookbooks/redis-yml/recipes/default.rb
if ['app_master', 'app'].include?(node[:instance_role])
redis_instance = node['utility_instances'].find { |instance| instance['name'] == 'redis' }
if redis_instance
node[:applications].each do |app, data|
template "/data/#{app}/shared/config/redis.yml"do
source 'redis.yml.erb'
owner node[:owner_name]