Skip to content

Instantly share code, notes, and snippets.

View genericsteele's full-sized avatar

Eric Steele genericsteele

View GitHub Profile

Jr. Rails Developer for Bidsketch.com

Thanks for your interest! We aren't looking for applicants at this time, but here is the original posting:

Hi there. I'm Eric. I spend my days working on [Bidsketch.com][home] with some [awesome people][about]. We are looking for a Jr. Rails Developer to:

  • Build features that make our customers more awesome
  • Respond to support requests from our awesome customers
  • Squash bugs and generally improve the Rails 2.3 app that makes it all possible
  • Take an active part in building fun stuff with a great team
@genericsteele
genericsteele / relative_failure.md
Last active August 29, 2015 13:58
Use relative paths in failed assertions

Monkey patch Minitest::Assertion#location...

## in test/test_helper.rb
class Minitest::Assertion
  alias_method :old_location, :location
  def location
    old_location.sub("#{Rails.root.to_s}/", '')
  end
end
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.4'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.2'
@genericsteele
genericsteele / readme.md
Last active August 29, 2015 13:57
Fixture label interpolation

Fixtures and $LABELs

Currently, fixtures can interpolate labels has values like so:

eric:
  name: $LABEL
  email: eric@iamericsteele.com
@genericsteele
genericsteele / agent.rb
Last active September 18, 2018 03:31
Custom Assertions
class Agent < ActiveRecord::Base
validates :first_name, :last_name, :email, presence: true
validates :email, uniqueness: true
has_many :missions
scope :on_assignment, -> { Agent.joins(:missions).where(missions: { status: 'active' }) }
scope :not_on_assignment, -> { where.not(id: Agent.on_assignment.pluck(:id)) }
def name
"#{first_name} #{last_name}"
end
@genericsteele
genericsteele / gist:7623193
Created November 24, 2013 04:04
Broken testable application controller in Rails 4.0.1
require 'test_helper'
class TestableApplicationController < ApplicationController
def test
render nothing: true
end
end
class TestableApplicationControllerTest < ActionController::TestCase
Santa::Application.routes.append do
@genericsteele
genericsteele / bull-china-shop.md
Created March 18, 2013 19:05
An excerpt from 'What do I Test?' a book on Rails testing:

An excerpt from 'What do I Test?', a book on Rails testing:

>Adding a new feature to an untested application is terrifying. It's like watching a bull walk into your china shop made out of playing cards. The only thing you can do is follow him around and monitor every single plate and dish he picks up. If you were sure that your walls wouldn't fall down, and that the bull was completely relaxed, you could get back to helping all the other anthropomorphic animals that have come into your china shop ready to spend their hard-earned animal money.

@genericsteele
genericsteele / sbt.help
Created June 27, 2012 00:25
Unresolved SBT dependency
webapp $ play
Getting org.scala-tools.sbt sbt_2.9.1 0.11.3 ...
:: problems summary ::
:::: WARNINGS
module not found: org.scala-tools.sbt#sbt_2.9.1;0.11.3
==== local: tried
/usr/local/bin/../Cellar/play/2.0.1/bin/../libexec/framework/../repository/local/org.scala-tools.sbt/sbt_2.9.1/0.11.3/ivys/ivy.xml
@genericsteele
genericsteele / state_hash.rb
Created March 27, 2012 13:37
A ruby hash of US states
def state_hash
{"Alabama" => "AL",
"Alaska" => "AK",
"Arizona" => "AZ",
"Arkansas" => "AR",
"California" => "CA",
"Colorado" => "CO",
"Connecticut" => "CT",
"Delaware" => "DE",
"District of Columbia" => "DC",
@genericsteele
genericsteele / state_array.rb
Created March 27, 2012 13:17
A ruby array of all the US state abbreviations
def state_array
%w(AK AL AR AZ CA CO CT DC DE FL GA HI IA ID IL IN KS KY LA MA MD ME MI MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VA VT WA WI WV WY)
end