Skip to content

Instantly share code, notes, and snippets.

@shime
shime / Gemfile
Created April 2, 2012 17:16
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
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
@shime
shime / ZR.rb
Created May 15, 2012 01:29 — forked from DamirSvrtan/ZR
ZR
require 'sinatra'
require 'rubygems'
require 'httparty'
require 'net/http'
require 'base64'
set :dump_errors, false
class Representative
include HTTParty
@shime
shime / hack.rb
Created May 20, 2012 16:21 — forked from rkh/hack.rb
Overriding a class instance method with a module
class Base
def call
'call'
end
end
p Base.new.call #=> "call"
# Monkeypatching "works" but doesn't provide access to #super
@shime
shime / twitterservice.cs
Created May 23, 2012 14:36 — forked from anonymous/twitterservice code
twitterservice code
/// <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 / dog_.rb
Created July 1, 2012 21:07 — forked from pankoholic/[email protected]
difference between using @ over self
class Dog
def age
@age
end
def initialize(age)
@age = age
end
end
@shime
shime / log.txt
Created August 19, 2012 11:32 — forked from steveklabnik/log.txt
A fun shell script from #euruku
$ 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 / 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
@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 / _readme.md
Last active November 11, 2024 01:23 — 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 / .gitignore
Last active December 24, 2015 17:39 — forked from uu59/.gitignore
socket.io and sinatra in action
vendor/
.bundle/
node_modules/
Gemfile.lock