Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am mikepack on github.
  • I am mikepack ( on keybase.
  • I have a public key ASAoHHutu5Q4xJx7dLfSuriZV7fgxkmWw1XRRm2JTcGM9go

To claim this, I am signing this object:

mikepack / null_object.rb
Created Feb 11, 2015
Polymorphic Null Object
View null_object.rb
class User
def name
'Mike Pack'
class GuestUser
def name
'Guest User'
mikepack / cars.rb
Created Feb 11, 2015
Polymorphic Cars
View cars.rb
class Car
def drive
# get_in
# park
class Ford < Car
View .irbrc
require 'irb/completion'
require 'brice'
Brice.init do |config|
config.exclude 'libs'
IRB.conf[:AUTO_INDENT] = true
mikepack / 1_inheritance.rb
Last active Aug 29, 2015
5 Composition Techniques
View 1_inheritance.rb
class Animal
def run
puts 'running'
end #=> running
class Wolf < Animal
def follow_pack
View gist:a54cc3bbcc70e63e46c2
# High-Low Testing
## Seeking a better workflow
## Dependencies are a necessary evil
## Getting started
### Testing high
### Testing low
## Isolating the framework
### Example refactor to isolate the framework
## Feedback, feedback, feedback
View nucleotide-count.js
var DNA = function(sequence){
this.sequence = sequence;
this.nucleotideCounts = this._countNucleotides();
DNA.prototype = {
count: function(marker){
return this.sequence.split(marker).length - 1;
mikepack /
Created Feb 28, 2014
Ember Component Test Helper
AppTest.setupComponent = (name, content, options, setupCallback=null)->
beforeEach ->
Ember.$('<div id="test-container"><div id="test"></div></div>').appendTo('body'); ->
AppTest.App = Ember.Application.create
rootElement: '#test'
mikepack / gist:8809257
Created Feb 4, 2014
The Old Reader Fluid badge and Growl notifications
View gist:8809257
setInterval(updateDockBadge, 5000);
setTimeout(notifyUnread, 5000);
var currentCount = '0';
function updateDockBadge() {
currentCount = jQuery('#unread_count .badge-info').text();
window.fluid.dockBadge = currentCount;
var oldCount = '0';
mikepack / gist:7900448
Last active Dec 30, 2015
Removing from all (Jasmine) tests
View gist:7900448

When testing Ember code, without putting expectations in a callback, you'll get this error:

Failure/Error: Assertion Failed: You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an

The error recommends wrapping expectations in

describe 'something', -&gt;