Skip to content

Instantly share code, notes, and snippets.

Avatar

Vincent Boisard elhu

View GitHub Profile
View pathfinder.go
package main
import (
"database/sql"
"fmt"
"github.com/Sereal/Sereal/Go/sereal"
_ "github.com/go-sql-driver/mysql"
"io/ioutil"
"os"
"strings"
View keybase.md

Keybase proof

I hereby claim:

  • I am elhu on github.
  • I am elhu (https://keybase.io/elhu) on keybase.
  • I have a public key whose fingerprint is 7AB7 DFD7 C4FA A954 D862 E0CF EF0D A9A9 F9BD 3296

To claim this, I am signing this object:

@elhu
elhu / app.rb
Last active Feb 11, 2016 — forked from archiloque/app.rb
Example of logging queries
View app.rb
require 'sinatra/base'
require 'sequel'
require 'logger'
# Add hooks in sequel logging since it's called for each query
module Sequel
class Database
# Alias a method so we can override it but still call the original
alias :log_yield_old :log_yield
@elhu
elhu / README.txt
Created Feb 5, 2014
Net::ReadTimeout weirdness
View README.txt
Some weird stuff about NetHTTP, the timeout is twice what it should be.
To test things out:
$> gem install sinatra
$> ruby server.rb
$> ruby client.rb
@elhu
elhu / Gemfile
Last active Jan 4, 2016
ruby-band basic
View Gemfile
source 'https://rubygems.org'
gem 'sinatra'
gem 'ruby-band'
@elhu
elhu / wrong argument type Proc (expected Proc)
Last active Dec 23, 2015
Errors occurring on Passenger 4 Enterprise 4.0.14
View wrong argument type Proc (expected Proc)
Backtrace:
On line #20 of app/views/layouts/application.html.erb
17: <%= execute_extensions_view_method :head %>
18: <%= custom_head_section %>
19: </head>
20: <% body_tag do %>
21: <%= admin_toolbar %>
22: <%= header %>
23: <% deprecated_doc4 yield(:document_class_for_sidebar) || 'yui-t7' do %>
@elhu
elhu / gist:5806022
Created Jun 18, 2013
Ferret with ruby 2.0.0p195
View gist:5806022
jenkins@ci [ideas_feature_remove-iconv] > gem install ferret
Building native extensions. This could take a while...
ERROR: Error installing ferret:
ERROR: Failed to build gem native extension.
/var/lib/jenkins/.rbenv/versions/2.0.0-p195/bin/ruby extconf.rb
creating Makefile
make
compiling STEMMER_stem_ISO_8859_1_dutch.c
@elhu
elhu / java1:elasticsearch.yml
Last active Dec 18, 2015
ElasticSearch unicast discovery problem
View java1:elasticsearch.yml
# from java1
cluster.name: dimelo
network.bind_host: 0.0.0.0
network.publish_host: 10.10.4.8
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["java1.dimelo:9200", "java2.dimelo:9200"]
View Stub issue
# Setup step
stub(Version.just_updated).paginate(:page => nil, :per_page => 50){ [@version_2, @version_3, @version_4] }
stub(Version.just_updated).paginate(:page => 2, :per_page => 50){ [@version_4, @version_3, @version_2] }
stub(Version.just_updated).paginate do |args|
raise args.inspect
end
# Test
should "raise an exception" do
pp Version.just_updated.paginate(:page => 3, :per_page => 50) #=> []
@elhu
elhu / gist:4065174
Created Nov 13, 2012
MongoDB question
View gist:4065174
class Band
include Mongoid::Document
store_in collection: "artists", database: "music", session: "secondary"
end
class BandsController < ApplicationController
before_filter :switch_database
after_filter :reset_database
private