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
# mygem/lib/test_support/cucumber/sniff_activity.rb | |
module Sniff | |
module Activity | |
def do_it | |
run.some_code.that_fails | |
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
var test = require('testling'), | |
CM1 = require('./lib/cm1'); | |
test('CM1.impacts', function(t) { | |
t.plan(3); | |
CM1.impacts('flight', { | |
origin_airport: 'IAD', | |
destination_airport: 'PDX', | |
airline: 'United', |
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
RSpec.configure do |c| | |
c.filter_run_excluding :database => true | |
c.include Rack::Test::Methods, :integration => true | |
c.before(:each, :database => true) do | |
setup_database | |
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
# Run me with: | |
# $ watchr rspec.watchr | |
# -------------------------------------------------- | |
# Rules | |
# -------------------------------------------------- | |
watch( '^spec/.*_spec\.rb' ) { |m| rspec m[0] } | |
watch( '^lib/(.*)\.rb' ) { |m| rspec "spec/#{m[1]}_spec.rb" } | |
watch( '^spec/spec_helper\.rb' ) { rspec specs } |
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
agave matured 8 years, shipped in hand-blown bottles from the volcanic hills of Jalisco | |
Blanco | |
slight vegetals, toasty, cherry | |
tripled distilled | |
Reposado | |
slight caramel smell, tart cherry, vanilla/toasty, slightest peach | |
aged 11 months in french oak barrels |
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
--- | |
title: Client-Sdie JavaScript Packaging | |
author: derek | |
layout: post | |
categories: technology | |
--- | |
One of the joys of Ruby is its package manager, rubygems. With a simple `gem install` you can add a library to your app. There has been an explosion of JavaScript package managers lately. Each one adds the basic ability to gather all of your libraries and application code, resolve the dependencies, and concatenate them into a single application file. They can be grouped into three basic categories: | |
<!-- more start --> |
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
# I have read http://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Resources.html#method-i-resources | |
# and remain clueless. | |
MyApp::Application.routes.draw do | |
resources :blogs do | |
resources :comments | |
end | |
# then imagine tons of routing below this | |
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
# hotness = age_in_minutes / (votes**2.5) | |
def original_hotness(now, created_at, votes) | |
age_in_minutes = (((created_at.to_f / 60).floor * 60) - ((now.to_f / 60).floor * 60)) / -60 | |
age_in_minutes / (votes**2.5) | |
end | |
def new_hotness(now, created_at, votes) |
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
click 'add Widget' | |
page.should have_content('widget added') |
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 Article < ActiveRecord::Base | |
has_many :authorships | |
has_many :authors, through: :authorships | |
def total_kudos | |
authors.sum(&:kudos) | |
end | |
end | |
# OK |