Skip to content

Instantly share code, notes, and snippets.

View zspencer's full-sized avatar

Zee zspencer

View GitHub Profile
@zspencer
zspencer / placer_of_need_spec.js
Created May 20, 2011 11:06
Screwy way to stub instantiation of a class in js
describe("PlacerOfNeed", function() {
var placer;
beforeEach(function() {
placer = new ForChange.PlacerOfNeed();
});
describe("Creating the marker", function() {
beforeEach(function() {
spyOn(google.maps, 'Marker')
});
it("Creates a google marker with the LatLng it created", function() {
@zspencer
zspencer / sinatra_base.rb
Created June 9, 2011 06:26
Code Review of sinatra/base.rb
# external dependencies
require 'rack'
require 'tilt'
# stdlib dependencies
require 'thread'
require 'time'
require 'uri'
# other files we need
@zspencer
zspencer / gist:1104447
Created July 25, 2011 15:55
Holy Crap
Macintosh:page-object zspencer$ rake
/Users/zspencer/.rvm/gems/ruby-1.9.2-p290@page-object/gems/yard-0.7.2/lib/yard.rb:38: [BUG] Bus Error
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
-- control frame ----------
c:0023 p:---- s:0072 b:0072 l:000071 d:000071 CFUNC :callcc
c:0022 p:0080 s:0069 b:0069 l:000290 d:000290 TOP /Users/zspencer/.rvm/gems/ruby-1.9.2-p290@page-object/gems/yard-0.7.2/lib/yard.rb:38
c:0021 p:---- s:0066 b:0066 l:000065 d:000065 FINISH
c:0020 p:---- s:0064 b:0064 l:000063 d:000063 CFUNC :require
c:0019 p:0071 s:0060 b:0060 l:002338 d:001e60 BLOCK /Users/zspencer/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:58
# I want to inject a dependency, but I don't want to pass it in the constructor....
# Basically testing around it was getting fairly bulky and ungainly, so I extracted the functionality
module ThatHadTooMuchComplexityInItsConstructor
def initialize(stuff)
@stuff = stuff
a = ThatBetterConformsToSRP.new
b = a.yea_do_your_thing stuff
end
@zspencer
zspencer / your_script.sh
Created September 6, 2011 22:58
Pair with Zee
#If you're on a mac/linux, you can just copy and paste this. If you're on Windows, you need to figure out how to do this using Putty.
ssh pair@pairwith.zeespencer.com
@zspencer
zspencer / mapform.js
Created September 14, 2011 12:16 — forked from mdoel/mapform.js
How to unit test this
$.fn.inFieldLabels = function() {}
$.fn.map_control = function() {}
$(document).ready(function() {
new MapForm();
});
(function() {
window.MapForm = function() {
$(document).ready(this.initialize);
};
@zspencer
zspencer / readme.mdown
Created October 18, 2011 17:07
CodeJo instructions

#What Is It? A CodeJo is where a group of developers of all skill levels get together and work on an exercise together. Special attention is paid to form; focusing primarily on the 4 rules of simple design, behavior driven development, and collaborative coding.

The 4 Rules of Simple Design

  • The software works as described by our tests
  • There is no duplication
  • The code expresses the intent of the developer
  • There are as few components as possible

Behavior Driven Development

@zspencer
zspencer / Rakefile
Created November 6, 2011 05:33
this is how you add the padrino rake tasks to your regular rake file
require './config/boot'
require 'padrino-core/cli/rake'
PadrinoTasks.init
@zspencer
zspencer / wtf.rb
Created November 26, 2011 23:16
Instance variables vs. class instance variables in Ruby
class Foo
@foo = 1
def initialize
@bar = 2
end
end
x = Foo.new
Foo.instance_Variables
x.instance_variables
@zspencer
zspencer / coding_the_distance.txt
Last active September 28, 2015 12:38
coding the distance.txt
Reluctantly crouched at the command line
keyboards clicking and clacking in time
the green bar flashes, the vim pops up
churning, and burning, they yearn for server up
they deftly maneuver and regex to rename
fingers flying fast keyboards in flame
reckless and wild, they commit and they push
their prowess is potent though they sit on their tush.
as they speed through the release, the deploy goes out
they all get up and pour themselves stout