Skip to content

Instantly share code, notes, and snippets.

View kaikuchn's full-sized avatar

Kai Kuchenbecker kaikuchn

View GitHub Profile
message = <<~MSG
When interpolating a String longer than 23 bytes in a <<~
heredoc, we get a "can't set length of shared string" error.
So running #{__FILE__} should raise in MRI 2.4.1p111 Rev 58053.
The same is not true for <<- heredocs! It is also already fixed
in Ruby Trunk:
kaikuchn /
Created May 20, 2017 21:52
verify kaikuchn for

Keybase proof

I hereby claim:

  • I am kaikuchn on github.
  • I am kaikuchn ( on keybase.
  • I have a public key ASDDerknzIYoMzODdc9ABFWBps5MGXuR1TZRMPALaWwSawo

To claim this, I am signing this object:

kaikuchn / Gemfile.lock
Created December 14, 2016 16:15
Gemfile.lock for hanami issue #696
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
ansi (1.5.0)
ast (2.3.0)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
Function find_or_create_node(dict As Dictionary, key As String) As Dictionary
If Not dict.Exists(key)
dict.Add(key, new Dictionary)
End If
Return dict.Item(key)
End Function
Sub initialize_or_increment_leaf(dict As Dictionary, key As String, value As Double)
If Not dict.Exists(key)
dict.Add(key, value)
Set projects_dict = CreateObject("Scripting.Dictionary")

// ... get a projekt-name, store it in 'key'

If Not projects_dict.Exists(key) Then
  projects_dict.Add key, CreateObject("Scripting.Dictionary")
End If

If projects_dict.Item(key).Exists(month) Then
kaikuchn / has_one_relation_test.rb
Created February 18, 2015 21:12
Reproducing Test for replacing has_one relation with uniqueness constraint
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source ''
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'i18n', github: 'svenfuchs/i18n'
gem 'sqlite3'
kaikuchn / arm.rb
Last active August 29, 2015 14:15
Single Association Replace Behavior
class Arm < ActiveRecord::Base
belongs_to :bandit, inverse_of: :arm
# instead of validating this here, you could also add a uniqueness
# constraint through a migration. Behavior would be similiar.
validates :bandit, uniqueness: true
kaikuchn / benchmark.rb
Last active December 7, 2015 08:47
bulk insert benchmark
#!/usr/bin/env ruby
require 'benchmark'
require File.expand_path('../config/environment', __FILE__)
@list = (0..10_000).map{|i| {word: "word_#{i}", word_translation: "translation_#{i}"}}
@vocabulary_1 = Vocabulary.create(user_id:, title: "Vocabulary #1")
@vocabulary_2 = Vocabulary.create(user_id:, title: "Vocabulary #2")
@vocabulary_3 = Vocabulary.create(user_id:, title: "Vocabulary #3")
kaikuchn / doctor_output
Created August 9, 2014 14:51
Output of rbenv doctor script
root@vmd3328:/var/www/bochumbbdevgroup/current# curl -s | bash -x 2>&1
+ rbenv --version
rbenv 0.4.0-98-g13a474c
+ rbenv versions
* 2.1.2 (set by /var/www/bochumbbdevgroup/current/.ruby-version)
+ rbenv global
+ env
kaikuchn / even_more_debug_info.patch
Created November 19, 2012 00:01
some more debug info via patchfile
From 24739f29e62afd1463db5251909eb31f7f5f1a68 Mon Sep 17 00:00:00 2001
From: Kai Kuchenbecker <>
Date: Mon, 19 Nov 2012 00:59:37 +0100
Subject: [PATCH] added some more logging info
src/log_pgsql.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/log_pgsql.c b/src/log_pgsql.c