Skip to content

Instantly share code, notes, and snippets.

View kouno's full-sized avatar

Vincent Bonmalais kouno

  • London, United Kingdom
View GitHub Profile
@kouno
kouno / test.rb
Created November 5, 2013 17:39
`if` weirdness
0 ? true : false
# => true
// ? true : false
# (irb):2: warning: regex literal in condition
# => false
'' ? true : false
# (irb):4: warning: string literal in condition
# => true
@kouno
kouno / recipe.rb
Created September 23, 2012 05:52
Chef command `execute` fail to enter ENV variables
# Install Gems with bundle install
execute "gitlab-bundle-install" do
command "bundle install"
cwd node['gitlab']['app_home']
user node['gitlab']['user']
group node['gitlab']['group']
end
===============
Error message
@kouno
kouno / gist:2878246
Created June 5, 2012 21:43
Inheritance of BigDecimal breaks is_a? function in JRuby
require "bigdecimal"
class Decimal < BigDecimal
end
# Inheritance breaks is_a? function
# Decimal.new("9876543210").is_a?(Decimal)
# => false
# jruby 1.6.7.2 (ruby-1.8.7-p357) (2012-05-01 26e08ba) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [darwin-x86_64-java]
puts "Decimal.new is a Decimal object?: #{Decimal.new("9876543210").is_a?(Decimal)}"