Skip to content

Instantly share code, notes, and snippets.

View collinschaafsma's full-sized avatar
👋

Collin Schaafsma collinschaafsma

👋
View GitHub Profile
@cookrn
cookrn / 00_desc.md
Created April 3, 2012 07:03
Ruby Object Constructors

What the what?!

Ruby objects can be built in a way such that they are easier to use/test/debug from the point of view that if you do not automatically run their intended functionality from the constructor, potential side-effects and bugs can be better examined.

In general, I find it helpful to consider a constructors' purpose constrained only to setting instance-level attributes based on the passed arguments or using pre-defined defaults. Anything outside of that, I would consider setting up a class-level factory method.

Consider creating semantically-named factory style class methods that create an object and then call a specific method.

I find this especially helpful for hand-rolled presenters and worker classes (e.g. for Resque).

@ahoward
ahoward / markup.rb
Created January 13, 2011 15:29
a little script to htmlize text files with github markup
#! /usr/bin/env ruby
# NAME
# markup
#
# DESCRIPTION
# filter files through the awesomeness of github markup
# see https://github.com/github/markup
#
# USAGE
# a little rake task to rename a Rails3 project. handles editing files,
# renaming files, and renaming directories. use NOOP=true to view
# edits/renames before performing them.
#
begin
### gem install map
#
### gem 'map'
#
@netzpirat
netzpirat / 0_README.md
Created November 12, 2010 10:42
Continuous CoffeeScript testing with Guard and Jasmine

Continuous CoffeeScript testing with Guard and Jasmine

This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo

  • Install Gems with Bundler with bundle install
  • Define your guards with mate Guardfile
  • Initialize Jasmine with bundle exec jasmine init
  • Configure Jasmine with mate spec/support/yasmine.ym
  • Start Guard with bundle exec guard