Skip to content

Instantly share code, notes, and snippets.

View takkanm's full-sized avatar

Mitsutaka Mimura takkanm

  • Tokyo, Japan
View GitHub Profile
% cat tmp/define_method_test.rb
class Foo
def foo
:foo
end
define_method(:bar) { :foo }
end
def time(method_name, count, &block)
start = Time.now
diff --git a/Headers/iTerm/PTYTextView.h b/Headers/iTerm/PTYTextView.h
index 54c192c..a75f0bc 100644
--- a/Headers/iTerm/PTYTextView.h
+++ b/Headers/iTerm/PTYTextView.h
@@ -100,6 +100,8 @@ typedef struct PTYFontInfo PTYFontInfo;
BOOL CURSOR;
BOOL colorInvertedCursor;
+ BOOL doCommandBySelectorCalled;
+
@takkanm
takkanm / amida.rb
Created June 3, 2012 00:58
みなとRuby会議01のソーシャルコーディングのやつ
class Amida
attr_reader :width, :height, :matrix
def initialize(size)
@size = size
@width = size - 1
@height = @width * 2
@matrix = Array.new(@height) { Array.new(@width) }
end
def gen(num)
#! /bin/sh
hub clone https://github.com/dproject21/yaruo_tdd_triangle
hub clone https://github.com/mataki/fast_spork_runner
hub clone https://github.com/randym/axlsx
hub clone https://github.com/todesking/okura
$ cat let.rb
describe do
let!(:a) { puts 'first let' }
before { puts 'before' }
let!(:b) { puts 'second let' }
it { true.should be_true }
end
$ rspec let.rb
def method_missing(*args)
args[0].to_s
end
p a
def gh_link(id_and_name)
name = id_and_name.split('/').last
"<a href='http://github.com/#{id_and_name}'>#{name}</a>"
end
#検証したいUserクラス
class User < ActiveRecord::Base
belongs_to :room
def wait(room)
room.wait
self.room = room
end
end
alias b="bundle"
alias bi="bundle install"
alias bu="bundle update"
alias be="bundle exec"
alias bo="bundle open"
alias s='spring'
alias g="git"
alias r="rails"
ken = 'けん'
prefixes = %w(さん くん ちゃん)
loop do
if (ken + (prefix = prefixes.sample)).size < 140
ken << prefix
else
break
end
end