Skip to content

Instantly share code, notes, and snippets.

View superchris's full-sized avatar

Chris Nelson superchris

View GitHub Profile
#= require fruit
class Apple extends Fruit
plant: -> alert "I am an apple tree"
<% if @project.isOnHold(): %>
On Hold
<% else if @project.isArchived(): %>
Archived
<% end %>
@superchris
superchris / loadTemplates.js
Created November 12, 2011 01:31
loading templates in jasmine specs
jasmine.Fixtures.prototype.loadTemplate_ = function(template) {
var templateUrl = "/backbone/templates/" + template;
var self = this;
$.ajax({
async: false, // must be synchronous to guarantee that no tests are run before fixture is loaded
cache: false,
dataType: 'html',
url: templateUrl,
success: function(data) {
$('#' + self.containerId).append(data);
@superchris
superchris / In the rails log.txt
Created February 14, 2012 22:15
Request in webkit inspector
Parameters: {"created_at"=>"2011-11-01T23:49:03Z", "description"=>"sumptin else to eat, yummy", "id"=>"2", "title"=>"Other Foods at codmash", "updated_at"=>"2012-01-13T19:29:42Z", "recipe"=>{"id"=>"2", "title"=>"Other Foods at codmash", "description"=>"sumptin else to eat, yummy", "created_at"=>"2011-11-01T23:49:03Z", "updated_at"=>"2012-01-13T19:29:42Z"}}
@superchris
superchris / rails_backbone_template.rb
Created March 16, 2012 23:08
Rails backbone template
gem "jasminerice"
gem "eco"
gem "rails-backbone"
gem "inherited_resources"
run "bundle install"
generate "backbone:install"
create_file File.join("spec", "javascripts", "spec.js.coffee"), <<EOF
@superchris
superchris / adcenter.rb
Created April 9, 2012 20:06
Adcenter savon example
module Microsoft
class Adcenter
MAX_RETRIES = 10
REPORT_WSDL_URL = "https://adcenterapi.microsoft.com/Api/Advertiser/v8/Reporting/ReportingService.svc?wsdl"
CUSTOMER_MANAGEMENT_WSDL_URL = "https://sharedservices.adcenterapi.microsoft.com/Api/CustomerManagement/v8/CustomerManagementService.svc?wsdl"
def credentials
@credentials ||= YAML::load(ERB.new(File.open(Rails.root.join("config", "adcenter.yml")).read).result)[Rails.env]
@superchris
superchris / table_row_view2.coffee
Created June 6, 2012 01:00
composite views blog pot code
class Example.Views.TableRowView extends Backbone.View
tagName: "tr"
attributes: ->
id: "row_#{@model.id}"
constructor: (options) ->
super
@parentView = options.parentView
@superchris
superchris / embedGist.js
Created June 6, 2012 14:02
no conflict embedGist
jQuery(".gist").each(function() { writeCapture.html(this, '<script src="'+jQuery(this).text()+'"></script>'); });
@superchris
superchris / game.coffee
Created June 15, 2012 19:37
bowling kata
describe "bowling", ->
beforeEach ->
@game = new Game
describe "no spare or strike", ->
beforeEach ->
@game.roll(3)
@game.roll(4)
@game.roll(7)
it "should calculate the score", ->
expect(@game.score()).toEqual 14
@superchris
superchris / checkout_cookbook.sh
Created July 28, 2012 17:33
command to checkout the cookbook app
#!/bin/bash
git clone git://github.com/gaslight/bfec_chicago.git cookbook
cd cookbook
bundle install --path vendor