I hereby claim:
- I am carlthuringer on github.
- I am carlthuringer (https://keybase.io/carlthuringer) on keybase.
- I have a public key ASChpeUaIF3y0bdYpCx4H24Yh3gFyu63erD7cpwPwOkKwwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
exceptions = [] | |
tree = {} | |
ObjectSpace.each_object(Class) do |cls| | |
next unless cls.ancestors.include? Exception | |
next if exceptions.include? cls | |
next if cls.superclass == SystemCallError # avoid dumping Errno's | |
exceptions << cls | |
cls.ancestors.delete_if {|e| [Object, Kernel].include? e }.reverse.inject(tree) {|memo,cls| memo[cls] ||= {}} | |
end |
#!/usr/bin/env ruby | |
def pop; $stack.pop || raise(StackUnderflow); end | |
def push(expression); $stack << expression; end | |
def unary; -> { push(yield pop) }; end | |
def binary; -> { push(yield pop, pop) }; end | |
def unary_boolean; -> { push(if yield pop then 1 else 0 end) }; end | |
def binary_boolean; -> { push(if yield pop, pop then 1 else 0 end) }; end | |
def swap; $stack[-2,2] = $stack[-2,2].reverse; end | |
$stack = [] |
<?php | |
/* | |
* calc_bmi | |
* The structure of this function is misleading and overcomplicated. | |
* The function returns false or a value, so any program calling it must handle | |
* either false or a value. | |
* Further, the function is burdened with mistrust and has misleading default arguments. | |
* The default arguments suggest that the function expects integers, but it actually handles strings and many other possible values. | |
*/ |
it "runs a workflow from java to ruby, back to java" do | |
# Because our Backbeat client is set up with the ruby credentials, we cannot use it to prove this test's functionality. | |
# Instead, we have to craft the requests by hand. | |
backbeat_host = URI("http://#{ENV['BACKBEAT_SERVER_HOST']}:#{ENV['BACKBEAT_SERVER_PORT']}") | |
# Create the workflow | |
create_workflow_request = Net::HTTP::Post.new(URI.join(backbeat_host, "/workflows")) | |
set_client_headers(create_workflow_request, :java) |
class CalculatesTax | |
include LightService::Organizer | |
def self.for_order(order) | |
with(:order => order).reduce( | |
[FetchesTaxRangesAction, FetchesCachedTaxRangesAction], | |
LooksUpTaxPercentageAction, | |
CalculatesOrderTaxAction, | |
ProvidesFreeShippingAction | |
fallback: GenericErrorHandler |
class Decorator | |
def self.decorate(subject) | |
subject.define_singleton_method(:with) do |delegate| | |
@delegate_list ||= [] | |
@delegate_list << delegate | |
end | |
subject.define_singleton_method(:method_missing) do |meth, *args, &block| | |
begin | |
@delegate_list.find do |delegate| |
/Users/carl/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/ethon-0.6.2/lib/ethon/easy/operations.rb:23: [BUG] Segmentation fault | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin13.0.2] | |
-- Control frame information ----------------------------------------------- | |
c:0098 p:---- s:0507 b:0507 l:000506 d:000506 CFUNC :easy_perform | |
c:0097 p:0024 s:0503 b:0503 l:000502 d:000502 METHOD /Users/carl/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/ethon-0.6.2/lib/ethon/easy/operations.rb:23 | |
c:0096 p:0036 s:0500 b:0500 l:000499 d:000499 METHOD /Users/carl/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/typhoeus-0.6.7/lib/typhoeus/request/operations.rb:16 | |
c:0095 p:0074 s:0496 b:0496 l:000495 d:000495 METHOD /Users/carl/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/typhoeus-0.6.7/lib/typhoeus/request/cacheable.rb:18 | |
c:0094 p:0050 s:0492 b:0492 l:000491 d:000491 METHOD /Users/carl/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/typhoeus-0.6.7/lib/typhoeus/requ |
require 'formula' | |
class Libstemmer < Formula | |
# upstream is constantly changing the tarball, | |
# so doing checksum verification here would require | |
# constant, rapid updates to this formula. | |
head 'http://snowball.tartarus.org/dist/libstemmer_c.tgz' | |
homepage 'http://snowball.tartarus.org/' | |
end |