Skip to content

Instantly share code, notes, and snippets.

View taqtiqa-mark's full-sized avatar

Mark Van de Vyver taqtiqa-mark

View GitHub Profile
BUNDLE_BIN: .bundle/bin
BUNDLE_SHEBANG: ruby-local-exec
BUNDLE_DISABLE_SHARED_GEMS: '1'
BUNDLE_PATH: vendor
# This is a code example for the Ruby HTTP library Typhoeus
# here's an example for twitter search
# Including Typhoeus adds http methods like get, put, post, and delete.
# What's more interesting though is the stuff to build up what I call
# remote_methods.
class Twitter
include Typhoeus
remote_defaults :on_success => lambda {|response| JSON.parse(response.body)},
:on_failure => lambda {|response| puts "error code: #{response.code}"},
@taqtiqa-mark
taqtiqa-mark / temporary_dsl.rb
Created December 2, 2012 07:48 — forked from sparkertime/temporary_dsl.rb
A Ruby 1.9 DSL strategy
# An unintrusive, temporary DSL strategy.
#
# Why discusses Ruby DSLs and instance_eval vs. block arguments:
# http://hackety.org/2008/10/06/mixingOurWayOutOfInstanceEval.html
#
# This takes advantage of some Ruby 1.9 features to implement a DSL mixin that
# is temporary and doesn't override locally defined methods.
class DslInstance
attr_accessor :script
@taqtiqa-mark
taqtiqa-mark / failing_any_instance_spec.rb
Created November 25, 2012 03:07
rspec-mocks issue #198
class ::Cli
def start
::Api.new(self)
end
end
class ::Api
end
describe ::Cli do
@taqtiqa-mark
taqtiqa-mark / happy-birthday-taqtiqa.txt
Created April 11, 2012 04:50
Happy birthday TAQTIQA!
Happy Birthday to you.
Happy Birthday to you.
Happy Birthday dear TAQTIQA.
Happy Birthday to you!