Skip to content

Instantly share code, notes, and snippets.

@miaout17
miaout17 / .tmux.conf
Created August 15, 2011 16:35
tmux-unbind-all-crash.patch
set-option -g prefix C-a
# If we perform "unbind-key a" within a keybind
# It will have very high probability to crash
bind-key u unbind-key -a
# Following code shows a general use case:
# * I want to unbind all keys in .tmux.conf, then bind everything by myself
# * I need a hotkey to reload my .tmux.conf script
# When I try to reload, tmux server crashes.
@miaout17
miaout17 / TCO11-R1-500.cpp
Created June 19, 2011 02:44
TCO11-R1-500.cpp
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
@miaout17
miaout17 / doctor.cpp
Created May 14, 2011 09:31
doctor.cpp
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cmath>
# This is derived version of https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/wordpress.rb
$KCODE='UTF8'
require 'rubygems'
require 'sequel'
require 'fileutils'
require 'yaml'
require 'ya2yaml'
module Jekyll
@miaout17
miaout17 / SRM499-550.cpp
Created March 9, 2011 01:26
SRM499-550
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
sample = 10000
change = 0
not_change = 0
$verbose = true
def log(s)
puts s if $verbose
end
參考xdite's blog http://blog.xdite.net/?p=1839
建立一個名為railsc的執行檔,以monkey patch的方式啟用wirble及hirb
將railsc存到你PATH下,並設定可執行(chmod 755)
執行railsc取代rails c,即可載入wirble及hirb,不用修改project directory下的東西
P.S.
ActiveRecord::Base.logger = Logger.new(STDOUT)
這個我還是寫在.irbrc裡(事實上我是用show_log和hide_log開關)
module Hello
def self.const_missing(name)
"Constant #{name}"
end
puts ABC # Constant ABC
end
puts DEF # uninitialized constant DEF (NameError)
```
ls -al;
second line
```
git clone -u /home2/username/bin/git-upload-pack [email protected]:~/repo/$1
cd $1
repo-config $1