Skip to content

Instantly share code, notes, and snippets.

@shime
shime / _readme.md
Last active November 8, 2020 08:54 — forked from ryin/tmux_local_install.sh
installation script for tmux 1.9a

Having trouble installing the latest stable version of tmux?

I know, official package for your OS/distro is outdated and you just want the newest version of tmux.

Well, this script should save you some time with that.

Prerequisities

  • gcc
@shime
shime / _readme.md
Last active December 18, 2015 01:49 — forked from mislav/_readme.md

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

@shime
shime / Gemfile
Last active December 16, 2015 11:39
using Sinatrify with ActionController::Metal
# ...
gem "sinatrify"
# ...
@shime
shime / github_secrets.md
Last active April 29, 2023 20:04
Secret Github Features

Taken from Zach Holman's "Git and Github Secrets".

Keyboard Shortcuts

t - quickly jump through files (similar to cmd+T in VI or Text Mate)

w - quickly switch branches

s - search

@shime
shime / eurucamp.md
Created January 18, 2013 13:09
Eurucamp 2012

I was lucky enough to attend Eurucamp a few days ago. It's a ruby camp held near Berlin, Germany.

@shime
shime / tracking.rb
Created December 21, 2012 19:04
Tracking request durations in Rails. Courtesy of @stathat
if Rails.env.production?
slow_logfile = File.open(Rails.root.join("log", "slow.log"), 'a')
slow_log = Logger.new(slow_logfile)
slow_log.level = Logger::INFO
ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, start, finish, id, payload|
duration = (finish - start) * 1000
StatHat::API.ez_post_value("rails request duration", "info@stathat.com", duration)
view_time = 0
db_time = 0
@shime
shime / sorting.rb
Created December 14, 2012 00:48
sortiranje sa hrvatskim znakovima
# encoding: UTF-8
# naravno, instalirati gem sa `gem install sort_alphabetical` prije upotrebe
require "sort_alphabetical"
puts ["ažbuka","čimpanza","zavičaj"].shuffle.sort_alphabetical
@shime
shime / versions_info.md
Created December 8, 2012 20:34
Using multiple Rails and Ruby versions

This is the tutorial that explains you how to use different Rails and Ruby versions on your machines.

It assumes you're using Ruby Version Manager.

Creating Rails app

rails _<VESRION>_ new test_app

E.G.

@shime
shime / .gvimrc
Created December 7, 2012 20:19
my vimrc and gvimrc
"" Used for codeschool color theme
color codeschool
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
autocmd User Rails let b:surround_{char2nr('-')} = "<% \r %>" " displays <% %> correctly
" highlight lines longer than 80 chars
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.\+/
@shime
shime / colors.rb
Created November 13, 2012 00:48 — forked from mmcdaris/colors.rb
used like puts color("yellow", "Morgan")
# this file provides a method for formatting color using ascii escapes
def color(color, content)
style = {'clear' => 0,
'bold' => 1, 'underline' => 4, 'blink' => 5, 'hide' => 8, 'black' => 30, 'red' => 31,
'green' => 32, 'yellow' => 33, 'blue' => 34, 'magenta' => 35, 'cyan' => 36, 'white' => 37, 'bgred' => 41,
'bggreen' => 42, 'bgyellow' => 43, 'bgblue' => 44, 'bgmagenta' => 45, 'bgcyan' => 46, 'bgwhite' => 47}
if style[color] != nil
"\033[#{style[color]}m#{content}\033[0m"
else