Skip to content

Instantly share code, notes, and snippets.

View superchris's full-sized avatar

Chris Nelson superchris

View GitHub Profile
@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 / 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"}}
<% if @project.isOnHold(): %>
On Hold
<% else if @project.isArchived(): %>
Archived
<% end %>
#= require fruit
class Apple extends Fruit
plant: -> alert "I am an apple tree"
class Apple extends Fruit
plant: -> alert "I am an apple tree"
@superchris
superchris / fruit.coffee
Created May 30, 2011 16:00
fruit coffee class
class Fruit
plant: -> alert "I am in the ground"
@superchris
superchris / application.js
Created May 29, 2011 22:41
rails 3.1 application.js
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
@superchris
superchris / asset_server.rb
Created May 21, 2011 18:01
asset server initializer
require 'tilt'
ENV['COFFEESCRIPT_SOURCE_PATH'] = Rails.root.join(
"app", "assets", "javascripts", "vendor", "coffee-script.js")
class BareCoffeeScriptTemplate < Sprockets::CoffeeScriptTemplate
def evaluate(scope, locals, &block)
@output ||= CoffeeScript.compile(data, :bare => true)
end
end
describe "Foo", ->
beforeEach ->
@foo1 = new Foo
@foo2 = new Foo
@foo1.get("bazzes").push "baz"
it "should not put foo1's bazzes in foo2", ->
expect(@foo2.get("bazzes").length).toEqual 0
@superchris
superchris / Foo.coffee
Created May 15, 2011 17:30
Foo model with defaults as a function
class Foo extends Backbone.Model
defaults: ->
name: "joe"
bazzes: []