Skip to content

Instantly share code, notes, and snippets.

@yasuhito
yasuhito / roodi.rake
Created March 30, 2010 07:26
roodi.rake
require "rake/tasklib"
require "roodi"
require "roodi_task"
RoodiTask.new do | t |
t.patterns = %w(lib/**/*.rb spec/**/*.rb features/**/*.rb)
end
@yasuhito
yasuhito / flay.rake
Created March 30, 2010 07:28
flay.rake
require "rake/tasklib"
require "flay"
require "flay_task"
FlayTask.new do | t |
# add directories such as app, bin, spec and test if need be.
t.dirs = %w( lib )
t.threshold = 0
end
@yasuhito
yasuhito / reek.rake
Created March 30, 2010 07:29
reek.rake
require "reek/rake/task"
#
# See the follwing URL for details:
# http://wiki.github.com/kevinrutherford/reek/rake-task
#
Reek::Rake::Task.new do | t |
t.fail_on_error = true
t.verbose = false
@yasuhito
yasuhito / flog.rake
Created March 30, 2010 07:30
flog.rake
require "rake/tasklib"
require "flog"
desc "Analyze for code complexity"
task :flog do
flog = Flog.new
flog.flog [ "lib" ]
threshold = 10
@yasuhito
yasuhito / gist:810706
Created February 4, 2011 03:47
.irbrc
require "irb/xmp"
# ヒストリの設定
require "irb/ext/save-history"
IRB.conf[ :EVAL_HISTORY ] = 10000
IRB.conf[ :USE_READLINE ] = true
IRB.conf[ :SAVE_HISTORY ] = 10000
IRB.conf[ :HISTORY_PATH ] = File::expand_path( "~/.irb_history" )
@yasuhito
yasuhito / gist:849216
Created March 1, 2011 14:42
ADDING (63 bytes)
#!ruby -n
p eval'"#{$`%1$s+$&%1$s}"%1$s'%".reverse.to_i"if/ .+/
@yasuhito
yasuhito / gist:1027152
Created June 15, 2011 13:56
legacy C でモック
// たとえばこういうシグニチャの関数があったとして、
// こいつをテストの実行時に mock 関数に置き換えたいとする
void die( const char *format, ... );
// die.h では関数ポインタを公開する (extern)。
extern void ( *die )( const char *format, ... );
// die.c では関数ポインタを定義してて、
// 同時にデフォルトの実装 _die() を代入してやる
@yasuhito
yasuhito / gist:1066316
Created July 6, 2011 01:00
Trema Ruby Refactoring TODO
  • OFPT_* messages
  • /* Immutable messages. */
  • OFPT_HELLO ... TEST, DOC (とりあえず完了)
  • OFPT_ERROR ... TEST, DOC (とりあえず完了)
  • OFPT_ECHO_REQUEST ... TEST, DOC (とりあえず完了)
  • OFPT_ECHO_REPLY ... TEST, DOC (とりあえず完了)
  • OFPT_VENDOR ... TEST, DOC (とりあえず完了)
  • /* Switch configuration messages. */
  • OFPT_FEATURES_REQUEST ... TEST, DOC (とりあえず完了)
  • OFPT_FEATURES_REPLY ... TEST, DOC
@yasuhito
yasuhito / yasuhito.el
Created October 28, 2011 02:57
Emacs 用 gist の設定
(add-to-load-path "~/.emacs.d/yasuhito/gist.el")
(require 'gist)
(setq gist-authenticate-function 'gist-basic-authentication)
(global-set-key (kbd "<f8>") 'gist-region-or-buffer)
@yasuhito
yasuhito / yasuhito.el
Created October 28, 2011 03:11
日本語のテスト
;;; 行末の空白を表示
(setq-default show-trailing-whitespace t)