Skip to content

Instantly share code, notes, and snippets.

View mjansen401's full-sized avatar

Mike Jansen mjansen401

View GitHub Profile
@mjansen401
mjansen401 / gist:963646
Created May 9, 2011 23:37
_square.html.erb_spec.rb
require 'spec_helper'
describe "games/_square.html.erb" do
before(:each) do
@ttt = mock(TicTacToe)
end
it "displays a filled square" do
@ttt.stub!(:square_empty?).and_return false
@ttt.stub!(:get_square_value).and_return "X"
@mjansen401
mjansen401 / Output
Created July 17, 2011 17:27
Gems for JRuby-1.6.2
hello_limelight mjansen$ rspec spec/activerecord_derby_spec.rb
-- create_table(:albums)
-> 2.6660s
-> 0 rows
-- create_table(:tracks)
-> 0.0260s
-> 0 rows
8
10
Sticky Fingers
@mjansen401
mjansen401 / TodosSpec.js
Created November 13, 2011 19:48
Todos Collection Spec
describe("Todos Collection", function () {
it("uses the Todo model", function () {
var todos = new Todo.collections.Todos();
expect(todos.model).toEqual(Todo.models.Todo);
});
});
@mjansen401
mjansen401 / gist:1362576
Created November 13, 2011 19:49
Todo Model
namespace("Todo.models", {
Todo: Backbone.Model.extend({})
});
@mjansen401
mjansen401 / gist:1362580
Created November 13, 2011 19:49
Jasmine.yml src_files
src_files:
- public/javascripts/vendor/namespace.js
- public/javascripts/vendor/jquery.js
- public/javascripts/vendor/underscore.js
- public/javascripts/vendor/backbone.js
- spec/javascripts/support/jasmine-jquery-1.3.1.js
- public/javascripts/application.js
- public/javascripts/**/*.js
@mjansen401
mjansen401 / gist:1362581
Created November 13, 2011 19:50
New Jasmine.yml
src_files:
- public/javascripts/vendor/namespace.js
- public/javascripts/vendor/jquery.js
- public/javascripts/vendor/underscore.js
- public/javascripts/vendor/backbone.js
- spec/javascripts/support/jasmine-jquery-1.3.1.js
- public/javascripts/application.js
- public/javascripts/models/*.js //Include directories in specific order to avoid dependency problems
- public/javascripts/collections/*.js
- public/javascripts/**/*.js
@mjansen401
mjansen401 / gist:1362582
Created November 13, 2011 19:51
Todo Collection 1
namespace("Todo.collections", {
Todos : Backbone.Collection.extend({
model: Todo.models.Todo
})
});
@mjansen401
mjansen401 / gist:1362586
Created November 13, 2011 19:52
Todos Spec 2
describe("Todos Collection", function () {
beforeEach(function () {
this.todos = new Todo.collections.Todos();
});
it("uses the Todo model", function () {
expect(this.todos.model).toEqual(Todo.models.Todo);
});
it("url is 'todos'", function () {
@mjansen401
mjansen401 / gist:1362587
Created November 13, 2011 19:52
Todo Collection 2
namespace("Todo.collections", {
Todos : Backbone.Collection.extend({
model: Todo.models.Todo
url: "todos"
})
});
@mjansen401
mjansen401 / gist:2630461
Created May 7, 2012 21:10
Tune Ruby's garbage collector
Courtesy of http://www.rubyenterpriseedition.com/documentation.html#_garbage_collector_performance_tuning
Add to your .bash_profile:
export RUBY_HEAP_MIN_SLOTS=500000
export RUBY_HEAP_SLOTS_INCREMENT=250000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=50000000