Skip to content

Instantly share code, notes, and snippets.

View john-griffin's full-sized avatar

John Griffin john-griffin

View GitHub Profile
@jamesarosen
jamesarosen / upgrading.md
Last active August 29, 2015 14:21
Upgrading to ember-qunit 0.3.2

Recently, I upgraded from ember-qunit 0.3.1 to 0.3.2. The main reason I wanted to upgrade was to take advantage of a new way of writing component tests.

Previously, there was no way to test how the component was actually used. A component test could instantiate a component and poke at its internals, but that isn't how we use components. We use them declaratively in templates. The old style also meant it was difficult to test block templates and impossible to test block parameters.

I really wanted the new test style, but it wasn't easy to get there. The following are my upgrade notes.

Gotcha: moduleForComponent Requires Three Arguments

Many of my old component tests looked like

@beef
beef / Gemfile
Created December 15, 2010 11:29
Production environment for Rails 3 on heroku with rack-cache
# Add this to your gem file
group :production do
gem 'dalli'
gem 'rack-cache', :require => 'rack/cache'
gem 'rack-contrib', :require => 'rack/contrib'
end
@mudge
mudge / canteen.coffee
Created October 31, 2011 23:05
A Hubot script to find out what is being served at the canteen today.
# Display what is for lunch today at the Macmillan canteen
#
# what's for lunch? - Returns the lunch options at the canteen today
jsdom = require 'jsdom'
formatOptions = (options) ->
options.replace(/(Veggie )?Main Course/, "").replace(/[\n\r]+/g, " ").trim()
module.exports = (robot) ->
@kylefinley
kylefinley / main.coffee
Created November 21, 2011 11:47
SproutCore 20 Routing + Statechart
require 'sproutcore'
require 'sproutcore-statechart'
require 'sproutcore-routing'
App = SC.Application.create()
App.GlobalNavController = SC.Object.create(
home: -> App.statechart.gotoState 'home'
about: -> App.statechart.gotoState 'about'
)
@ldunn
ldunn / gist:1526376
Created December 28, 2011 04:52
Cards Against Humanity (black)
_? There's an app for that
Why can't I sleep at night? _
What's that smell? _
I got 99 problems but _ ain't one.
Who stole the cookies from the cookie jar? _
What's the next Happy Meal (r) toy? _
Anthropologists have recently discovered a primitive tribe that worships _.
It's a pity that kids these days are all getting involved with _.
During Picasso's often-overlooked Brown Period, he produced hundreds of paintings of _.
Alternative medicine is now embracing the curative powers of _.
Viz.WidgetsController = Ember.ArrayController.extend
init: ->
@refresh()
setInterval (=> @refresh), 5000
refresh: ->
$.ajax
url: @get('src'),
type: "GET",
context: this,
@olivierlacan
olivierlacan / rails_default_diff.sh
Created July 7, 2012 20:31
Track changes to a skeleton Rails app since a given version
#!/usr/bin/env zsh
# -------------------------------------------------------------------------------- #
# 1304046900 Track changes to a skeleton Rails app since a given `base_version`
# -------------------------------------------------------------------------------- #
## Changelog
# - Update 7/7/2012:
# * rewrote to use Bundler instead of RubyGems
# * attempting to switch to a master branch for which no commit existing was causing a pathspec error
# * simplified rails new commands by running them on the current path (after changing directory to tmp/skeleton_check of course).
# * renamed `old_version` variable to `base_version` for clarity
#original attribution https://gist.github.com/alexspeller/6251054 & https://gist.github.com/stevekane/6356006
App.ClickElsewhereMixin = Ember.Mixin.create
#use this method hook to define your desired behavior
onClickElsewhere: Ember.K
#bound version of our instance method
clickHandler: Em.computed ->
Em.run.bind @, 'onClickElsewhere'
@ABrambleNinja
ABrambleNinja / open_uri.rb
Last active December 18, 2015 22:39 — forked from zaius/open_uri.rb
# Allow open-uri to follow unsafe redirects (i.e. https to http).
# Relevant issue:
# http://redmine.ruby-lang.org/issues/3719
# Source here:
# https://github.com/ruby/ruby/blob/trunk/lib/open-uri.rb
module OpenURI
class <<self
alias_method :open_uri_original, :open_uri
alias_method :redirectable_cautious?, :redirectable?
@deepak
deepak / Dockerfile
Created July 5, 2013 06:59
Dockerfile to install ruby using brightbox deb
# DOCKER-VERSION 0.4.8
FROM ubuntu:12.04
MAINTAINER Deepak Kannan "deepak@codemancers.com"
RUN apt-get -y install python-software-properties
RUN apt-add-repository -y ppa:brightbox/ruby-ng-experimental
RUN apt-get -y update