Skip to content

Instantly share code, notes, and snippets.

View toch's full-sized avatar
🐱

Christophe Philemotte toch

🐱
View GitHub Profile
@toch
toch / docset_for_gem.sh
Created April 26, 2016 15:42
a Bash script to generate docset for Zeal from a group of gems
#!/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 / .uxterm_settings
Created July 31, 2012 10:28
My uxterm config with clickable url
UXTerm*background: black
UXTerm*foreground: white
UXTerm*cursorColor: grey
UXTerm*faceName: Liberation Mono
UXTerm*faceSize: 11
UXTerm*VT100*translations: #override Shift <Btn1Up>: exec-formatted("firefox '%t'", PRIMARY)
UXTerm*charClass: 33:48,36-47:48,58-59:48,61:48,63-64:48,95:48,126:48
@toch
toch / fibonacci.cpp
Created May 9, 2015 14:42
fibonacci template C++
template<int n>
struct fibonacci
{
static constexpr int value = fibonacci<n-1>::value + fibonacci<n-2>::value;
};
template<>
struct fibonacci<0>
{
static constexpr int value = 0;
};
@toch
toch / ensure_teardown.rb
Created July 12, 2016 14:40
Test how we can release resources or processes when an exception is raised during test
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 / toch-talks.md
Last active July 3, 2016 09:15
Talks and Workshops
@toch
toch / pg_jsonb.rb
Created May 26, 2016 16:06
A Hanami Coercer for PG JSONB Datatype
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)