Skip to content

Instantly share code, notes, and snippets.

🐱

Christophe Philemotte toch

🐱
Block or report user

Report or block toch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@toch
toch / ensure_teardown.rb
Created Jul 12, 2016
Test how we can release resources or processes when an exception is raised during test
View ensure_teardown.rb
require "minitest/autorun"
def raise_an_exception
raise "Raised!"
end
module Minitest
module Ensure
def ensure_to_call_after(name)
old_test_method = instance_method("test_#{name}")
@toch
toch / pg_jsonb.rb
Created May 26, 2016
A Hanami Coercer for PG JSONB Datatype
View pg_jsonb.rb
require "hanami/model/coercer"
require "sequel"
require "sequel/extensions/pg_json"
class PGJsonB < Hanami::Model::Coercer
def self.dump(hash_map)
::Sequel.pg_jsonb(hash_map)
end
def self.load(jsonb)
@toch
toch / docset_for_gem.sh
Created Apr 26, 2016
a Bash script to generate docset for Zeal from a group of gems
View docset_for_gem.sh
#!/bin/bash
# rubygem is required
# yard is required: gem install yard
# doc_to_dash is required: gem install doc_to_dash
GEM_NAME_PREFIX=$1
DOCSET_DIR=$2
TMP_DIR=$(mktemp -d)
@toch
toch / Rakefile
Created Jan 19, 2016
mruby minimum Rakefile
View Rakefile
APP_ROOT=ENV["APP_ROOT"] || Dir.pwd
# avoid redefining constants in mruby Rakefile
mruby_root=File.expand_path(ENV["MRUBY_ROOT"] || "#{APP_ROOT}/mruby")
mruby_config=File.expand_path(ENV["MRUBY_CONFIG"] || "build_config.rb")
ENV['MRUBY_ROOT'] = mruby_root
ENV['MRUBY_CONFIG'] = mruby_config
Rake::Task[:mruby].invoke unless Dir.exist?(mruby_root)
Dir.chdir(mruby_root)
load "#{mruby_root}/Rakefile"
@toch
toch / define_method_vs_module_eval.rb
Last active Dec 12, 2015
Example of usage of benchmark-lab on JuanitoFatas/fast-ruby
View define_method_vs_module_eval.rb
require 'benchmark/lab'
def method_names(number)
number.times.map do
10.times.inject("") { |e| e << ('a'..'z').to_a.sample}
end
end
class DefineMethod
def self.def_methods(_methods)
@toch
toch / README.md
Last active Nov 25, 2015
A message to mruby contributors
View README.md

Hi all,

It's the second year that me and Tyler are organizing the Ruby devroom at fosdem 2016. It focuses on Ruby internals and implementations. It's more about how Ruby is implemented than how it can be used. Last year we had great devs for MRI, Jruby, Rubinius, or Rubymotion. It would be wonderful to have a talk about mruby.

The CFP is open and ends on the 1st December.

Thanks for sharing it with other mruby contributors.

You can’t perform that action at this time.