Skip to content

Instantly share code, notes, and snippets.

View IdahoEv's full-sized avatar

Evan Dorn IdahoEv

View GitHub Profile
@IdahoEv
IdahoEv / Gemfile
Created August 12, 2011 00:13
Full-stack integration testing without Cucumber: using the RSpec-Steps/Capybara/Selenium stack
group :development, :test do
gem 'rspec'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'ruby-debug'
gem 'capybara'
gem 'launchy'
gem 'thin'
gem 'database_cleaner'
gem 'rspec-steps'
@IdahoEv
IdahoEv / gist:2492615
Created April 25, 2012 19:33 — forked from thommahoney/gist:2491946
RailsConf 2012 Lightning Talks
5 min:
~Objective-C + Rails:
Communicating w/rails from iOS/mac OS
Dan Hassin
1 min:
~Painless Javascript
koting hatduklgg
with wind tunnel
@IdahoEv
IdahoEv / gist:2715220
Created May 17, 2012 00:40
Brew errors on clean Lion 10.7.3 install
unknownb88d122def24:~ evan$ chown -r evan /usr/local/share/locale/
chown: illegal option -- r
usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...
chown [-fhv] [-R [-H | -L | -P]] :group file ...
unknownb88d122def24:~ evan$ chown -R evan /usr/local/share/locale/
chown: /usr/local/share/locale//be/LC_MESSAGES/gnupg.mo: Operation not permitted
chown: /usr/local/share/locale//be/LC_MESSAGES: Operation not permitted
chown: /usr/local/share/locale//be: Operation not permitted
chown: /usr/local/share/locale//ca/LC_MESSAGES/gnupg.mo: Operation not permitted
chown: /usr/local/share/locale//ca/LC_MESSAGES: Operation not permitted
@IdahoEv
IdahoEv / gist:3164868
Created July 23, 2012 17:26
Crappy code to emit a menu
# Submission to the Cascadia ruby ticket giveaway: https://codeclimate.com/cascadiaruby.
#
# We have a Location model used to model a heirarchical menu tree with acts_as_awesome_nested_set,
# so the client can edit his nav menu. This horrific beast is what outputs the menu, generating
# a zillion database hits in the process. NOTE: all this effort is for a menu that typically has
# all of ten items in it.
## app/views/shared/_location_subtree.html.haml
%li{ :class => matches_current_path?(location) ? "current" : nil }
= link_to(location.name.titleize, loc_path(location))
@IdahoEv
IdahoEv / My .ackrc
Created May 15, 2013 00:16
A pretty basic ackrc for Rails development
--ignore-dir=tmp
--ignore-dir=log
--type-add=ruby=.haml,.builder,.rake
--type-add=css=.sass,.scss
--type-add=js=.coffee
--type-set=markdown=.markdown,.md,.mdown
--type-set=actionscript=.as
--type-set=cucumber=.feature
--type-set=rdoc=.rdoc
@IdahoEv
IdahoEv / development.log
Created May 21, 2013 23:36
log of rake db:test:prepare
Connecting to database specified by database.yml
(0.9ms) SELECT * FROM geometry_columns WHERE f_table_name='schema_migrations'
(0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
(119.4ms) DROP DATABASE IF EXISTS "lvs_test"
(359.1ms) CREATE DATABASE "lvs_test" ENCODING = 'utf8' TEMPLATE = "template_postgis"
(14.8ms) CREATE TABLE "buyers" ("id" serial primary key, "street_address_1" character varying(255), "street_address_2" character varying(255), "city" character varying(255), "state" character varying(255), "zip" character varying(255), "description" text, "company" character varying(255), "phone_number" character varying(255), "buyer_type" character varying(255), "purchases_per_month" character varying(255), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "default_image_id" integer, "geocoded_street_address" character varying(255), "geocoded_city_address" character varying(255), "geocoded_zip" character varying(255), "geocoded_coordinates" geometry)
require 'spec_helper'
describe CtrReportPresenter do
describe "when given date params, a query class, and a grouper class" do
let :start_date do
(Time.now - 10.days).beginning_of_day
end
let :end_date do
Time.now.beginning_of_day
require 'spec_helper'
describe RegistrationsController do
before :each do
request.env['devise.mapping'] = Devise.mappings[:user]
end
steps "create" do
render_views
@IdahoEv
IdahoEv / review
Created February 17, 2014 21:11
Quick and dirty script for reviewing pull request branches
#!/bin/bash
# usage: 'review <branchname>'
git checkout master
git pull
git fetch
git checkout $1
git pull origin $1 # necessary if branch was already checked out
bundle
bundle exec rake db:migrate
module UsefulStuff
module ClassMethods
def thing_count
@thing_count ||= 0
end
def set_count(val)
@thing_count = val
end
end