Skip to content

Instantly share code, notes, and snippets.

@shime
shime / .gitignore
Last active Dec 24, 2015 — forked from uu59/.gitignore
socket.io and sinatra in action
View .gitignore
vendor/
.bundle/
node_modules/
Gemfile.lock
@shime
shime / _readme.md
Last active Aug 15, 2019 — forked from ryin/tmux_local_install.sh
installation script for tmux 1.9a
View _readme.md

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
View _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 / colors.rb
Created Nov 13, 2012 — forked from mmcdaris/colors.rb
used like puts color("yellow", "Morgan")
View colors.rb
# 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
@shime
shime / log.txt
Created Aug 19, 2012 — forked from steveklabnik/log.txt
A fun shell script from #euruku
View log.txt
$ history | awk {'print $2, $3, $4'} | sort | uniq -c | sort -k1 -rn | head -n 30
610 git status
568 git commit -m
491 git add .
252 git push origin
176 bundle
138 rails s
128 ls
120 git commit --amend
114 git reset --hard
@shime
shime / dog_.rb
Created Jul 1, 2012 — forked from pankoholic/dog_@.rb
difference between using @ over self
View dog_.rb
class Dog
def age
@age
end
def initialize(age)
@age = age
end
end
View twitterservice.cs
/// <summary>
/// Dohvaća pratitelje trenutnog korisnika
/// </summary>
/// <param name="AccessToken">
/// Access token povezan sa računom trenutnog korisnika
/// </param>
/// <returns>Lista profila pratitelja trenutnog korisnika</returns>
public static List<TwitterUserProfile> GetFollowers(TwitterTokens AccessToken)
{
@shime
shime / hack.rb
Created May 20, 2012 — forked from rkh/hack.rb
Overriding a class instance method with a module
View hack.rb
class Base
def call
'call'
end
end
p Base.new.call #=> "call"
# Monkeypatching "works" but doesn't provide access to #super
@shime
shime / ZR.rb
Created May 15, 2012 — forked from DamirSvrtan/ZR
ZR
View ZR.rb
require 'sinatra'
require 'rubygems'
require 'httparty'
require 'net/http'
require 'base64'
set :dump_errors, false
class Representative
include HTTParty
@shime
shime / Gemfile
Created Apr 2, 2012
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
View Gemfile
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
You can’t perform that action at this time.