Skip to content

Instantly share code, notes, and snippets.

View developwithpassion's full-sized avatar

Jean-Paul S. Boodhoo developwithpassion

View GitHub Profile
#!/usr/bin/ruby
#
# Download and execute this script in one-line with no temporary files:
#
# ruby -e "$(curl http://gist.github.com/raw/436471/install_homebrew.rb)"
#
#
# I deliberately didn't DRY /usr/local references into a variable as this
# script will not "just work" if you change the destination directory. However
# please feel free to fork it and make that possible.
@developwithpassion
developwithpassion / vikingrc.rb
Created April 7, 2011 21:55
Current vikingrc file
require '~/viking_develop_with_passion.rb'
# Ignore the following apps
disable "Remote Desktop Connection"
disable /VirtualBox/
#----------------------------------------
#core_shortcuts
#----------------------------------------
toggle "<Cmd-Shift-E>"
map "<Cmd-d>" { application_previous }
class Command
def initialize(action,description)
@action = action
@description = description
end
def call
@action.call
end
def to_s
"#{@description}"
@developwithpassion
developwithpassion / gist:1068011
Created July 6, 2011 18:44
Working mspec example
public class when_doing_something
{
It should_complete = () =>
{
new SomeClass().DoSomething().ShouldBeTrue();
};
}
@developwithpassion
developwithpassion / gist:1068016
Created July 6, 2011 18:46
Non working mspec
public class SomeClassSpecs
{
public class when_doing_something
{
It should_complete = () =>
{
new SomeClass().DoSomething().ShouldBeTrue();
};
}
}
public class when_doing_something :Observes<SomeClass>
{
It should_complete = () =>
{
sut.DoSomething().ShouldBeTrue();
};
}
@developwithpassion
developwithpassion / gist:1205501
Created September 9, 2011 04:34
Chrome url complete and trigger
only /Chrome/ do
imap "<Cmd-o>", lambda{
send(".com<Enter>")
}
end
@developwithpassion
developwithpassion / gist:1925656
Created February 27, 2012 17:27
RSpec Matchers for developwithpassion_fakes
module RSpec
Matchers.define :have_received do|symbol,*args|
match do|fake|
result = true
method = fake.received(symbol)
result &= method != nil
unless (args.count == 0)
result &= method.called_with(*args) != nil
end
@developwithpassion
developwithpassion / gist:3190414
Created July 27, 2012 20:49
MacRuby 0.12 failing case
describe 'When extending an item with a dynamic module that dynamically defines methods' do
before (:each) do
@target = Object.new
@the_module = Module.new do
define_method :age do
33
end
end
end
@developwithpassion
developwithpassion / validation.coffee
Created October 18, 2013 19:13
Hey guys, this is a spike I threw together for validation. Thoughts, comments?
ValidationRule = Ember.Object.extend
description: null
constraint: null
validate: (target) ->
return @constraint.call(target)
ValidationResult = Ember.Object.extend
successfulRules: []
brokenRules: []