View return type decorator.rb
1 2 3 4 5 6 7 8 9 10
[1] pry(main)> def returns(type)
[1] pry(main)* ->(method_name) {
[1] pry(main)* old_method = instance_method(method_name)
[1] pry(main)* define_method(method_name) do |*args, &block|
[1] pry(main)* return_value = old_method.bind(self).call(*args, &block)
[1] pry(main)* unless return_value.class <= type
[1] pry(main)* raise TypeError, "Return value is not of type #{type}!"
[1] pry(main)* end
[1] pry(main)* return_value
[1] pry(main)* end
View o.rb
1 2 3 4 5 6 7 8 9
class Proc
def |(other)
->(*args) { self.(*args) || other.(*args) };
end
def &(other)
->(*args) { self.(*args) && other.(*args) }
end
end
View user_creator.rb
1 2 3 4 5 6 7 8 9 10
class UserCreator
def initialize(listener)
@listener = listener
end
def create(attributes)
user = User.new(attributes)
if user.save
# send email
View gist:62bb5466f85893482238
1 2 3 4 5 6 7 8 9
### Keybase proof
 
I hereby claim:
 
* I am banister on github.
* I am banisterfiend (https://keybase.io/banisterfiend) on keybase.
* I have a public key whose fingerprint is 4DE2 CE74 F739 8BE1 F95A 1CD2 D551 92EA 0E1F 312C
 
To claim this, I am signing this object:
View pry_gist.rb
1 2 3 4 5 6 7 8 9 10
class Blah
def add(x, y)
x + y
end
end
# => nil
class Symbol
def call(*args, &block)
->(o) { o.send(self, *args, &block) }
end
View git aliases
1 2 3 4 5 6 7 8 9 10
alias.unstage=reset HEAD --
alias.br=branch
alias.co=checkout
alias.ci=commit
alias.last=log -1 -p HEAD
alias.fi=diff --name-only
alias.di=diff
alias.st=status -s --untracked=no
alias.dc=diff --cached
alias.rmc=rm --cached
View gist:7772063
1 2 3 4 5 6 7 8 9 10
[10] pry(main)>
~CORE (feature/multiple-enrollments ✘)✭ ᐅ bundle exec cap production db:clone_to_local
triggering load callbacks
* 2013-12-03 17:13:19 executing `production'
triggering start callbacks for `db:clone_to_local'
* 2013-12-03 17:13:19 executing `multistage:ensure'
* 2013-12-03 17:13:19 executing `db:clone_to_local'
* 2013-12-03 17:13:19 executing `db:dump_to_local'
* 2013-12-03 17:13:19 executing `db:database_creds'
pg_dump: unrecognized option `--exclude-table-data=subscriptions'
View init.el
1 2 3 4 5 6 7 8 9
(add-to-list 'load-path "~/.emacs.d/")
(add-to-list 'load-path "~/.emacs.d/ruby-dev/")
(add-to-list 'load-path "~/.emacs.d/themes/")
 
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
 
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
View break-and-run.rb
1 2 3 4 5 6
Pry.commands.command "break-and-run" do
method_name = arg_string.split("(").first
run "break #{method_name}"
input = StringIO.new arg_string
Pry.start(target, :input => input)
end
View init.el
1 2 3 4 5 6 7 8 9 10
;; ensure tabs are specially colored, since they mess up things in
;; langs like coffeescript
(defface extra-whitespace-face
'((t (:background "pale green")))
"Used for tabs and such.")
 
(defvar my-extra-keywords
'(("\t" . 'extra-whitespace-face)))
 
;; coffeescript specific hooks
Something went wrong with that request. Please try again.