Skip to content

Instantly share code, notes, and snippets.

View bartlomiejdanek's full-sized avatar

Bartłomiej Danek bartlomiejdanek

View GitHub Profile
@bartlomiejdanek
bartlomiejdanek / hash_fail.rb
Created April 9, 2013 05:55
hash clone/dup/deep_dup fail
require 'active_support/core_ext/hash/deep_dup'
h = {a: {b: :c}, d: {e: {f: :g}}}
p "Base h: #{h.object_id}"
p "Base h[:a]: #{h[:a].object_id}"
p "Base h[:d][:e][:f] #{h[:d][:e][:f].object_id}"
puts "--------------------------------------------------------------"
_dup = h.dup
p "Dup h: #{_dup.object_id}"
p "Dup h[:a]: #{_dup[:a].object_id}"
p "Dup h[:d][:e][:f] #{_dup[:d][:e][:f].object_id}"
" Improve move speed
let g:boostmove=0
set updatetime=500
au CursorMoved * call BoostMoveON()
au CursorMovedI * call BoostMoveON()
au CursorHold * call BoostMoveOFF()
au CursorHoldI * call BoostMoveOFF()
function BoostMoveON()
if (winline() != line('$')) && (line('.') != 1)
if (winline() == winheight('.')) || (winline() == 1)
@bartlomiejdanek
bartlomiejdanek / poc_constantize
Created February 14, 2013 14:44
poc_constantize rails issue
➜ projects git clone git://github.com/stevo/poc_constantize.git
Cloning into 'poc_constantize'...
remote: Counting objects: 66, done.
remote: Compressing objects: 100% (48/48), done.
remote: Total 66 (delta 2), reused 66 (delta 2)
Receiving objects: 100% (66/66), 26.54 KiB, done.
Resolving deltas: 100% (2/2), done.
➜ projects cd poc_constantize
➜ poc_constantize git:(master) rvm use 1.9.3@poc --create
Using /Users/bard/.rvm/gems/ruby-1.9.3-p385 with gemset poc
@bartlomiejdanek
bartlomiejdanek / pry-incremental-search-fix
Created November 28, 2012 09:30
ruby 1.9.3 iterm2 pry
$ rvm pkg install readline --verify-downloads 1
$ rvm install 1.9.3 --with-readline-dir=$rvm_path/usr --force
$ gem install pry
$ $ pry
(reverse-i-search)`':
[2] pry(main)>
@bartlomiejdanek
bartlomiejdanek / git_force_update_submodules
Created October 24, 2012 09:34
git_force_update_submodules
git submodule foreach 'echo $path `git checkout master --force; git pull --force`'
@bartlomiejdanek
bartlomiejdanek / algorytm_robienia_kawy.rb
Created September 25, 2012 14:12
Algorytm robienia kawy
# encoding: utf-8
module Selleo::Kuchnia
class PojemnikNaKapsułki
include Singleton
state_machine :initial => :pusty do
state :pusty
state :pełny
@bartlomiejdanek
bartlomiejdanek / .tmux.conf
Created March 29, 2012 06:43
tmux configuration
setw -g xterm-keys on
set -g terminal-overrides "*88col*:colors=88,*256col*:colors=256,xterm*:colors=256"
set -g default-terminal "screen-256color"
set-option -g prefix C-a
bind-key C-a last-window
bind-key ` last-window
bind-key a send-prefix
#set-option -g mouse-select-pane on
@bartlomiejdanek
bartlomiejdanek / .bashrc
Created February 13, 2012 17:28
.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
if [[ -n "$PS1" ]] ; then
#[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
@bartlomiejdanek
bartlomiejdanek / god
Created February 1, 2012 14:54
/etc/init.d/god
#!/bin/sh
### BEGIN INIT INFO
# Provides: god
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: God
@bartlomiejdanek
bartlomiejdanek / 0-readme.md
Created January 30, 2012 10:49 — forked from burke/0-readme.md
ruby-1.9.3-p0 cumulative performance patch.

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.