This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(create-fontset-from-ascii-font "Menlo-14:weight=normal:slant=normal" nil "menlomarugo") | |
(set-fontset-font "fontset-menlomarugo" | |
'unicode | |
(font-spec :family "Hiragino Maru Gothic ProN" :size 16) | |
nil | |
'append) | |
(add-to-list 'default-frame-alist '(font . "fontset-menlomaruugo")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
class Command | |
attr_accessor :command, :status, :out | |
def initialize(command) | |
@command = command | |
self | |
end | |
def run | |
@out = `#{@command} 2>&1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
#raise Exception | |
String.send(:bar) | |
rescue Exception => e | |
puts "rescue Exception" | |
puts "[Exception class: #{e.class}] [message: #{e.message}] [backtrace: #{e.backtrace}]" | |
# puts e.class | |
# puts e.message | |
# puts e.backtrace | |
# puts e.methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyException < StandardError | |
attr_accessor :log_level | |
def initialize(log_level, message) | |
@log_level = log_level | |
super message | |
end | |
def log | |
"[Exception class: #{self.class}] [message: #{message}] [backtrace: #{backtrace}]" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/build/ | |
/*.xcodeproj/[USERNAME].* | |
# [USERNAME] は 自分の名前に置き換え |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# 鬼車リファレンス | |
# http://www.geocities.jp/kosako3/oniguruma/doc/RE.ja.txt | |
require 'kconv' | |
Dir.glob('**/*.*'){ |f| | |
puts "■file: #{f}" | |
File.open(f, "r"){ |file_hundle| | |
contents = file_hundle.read | |
encoding = Kconv.guess(contents) | |
contents.force_encoding(encoding) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var p = function { print; }; | |
var i18n = {}; | |
i18n['hoge'] = "Hello"; | |
var _ = function(key) { return i18n[key]; }; | |
p(_('hoge')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requireFileOnce = function( checkType, js_name ){ | |
if(typeof(checkType) == 'undefined'){ | |
if( typeof(js_name) == 'string'){ | |
document.write('<script type="text/javascript" src="/javascripts/' + js_name + '.js"></script>'); | |
}else{ | |
for( var i=0; i<js_name.length; i++ ){ | |
document.write('<script type="text/javascript" src="/javascripts/' + js_name[i] + '.js"></script>'); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'zipruby' | |
buffer = Zip::Archive.open_buffer(Zip::CREATE) do |ar| | |
ar.add_buffer('zoo.txt', 'Hello, world!') | |
end | |
File.open('out.zip',"wb"){ |f| | |
f.write buffer | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# 使い方:wkhtmltoimage と 対象のHTMLフォルダを置いて実行してください。 | |
@option = "--width 480" | |
@out_ext = "png" | |
@out_path = "output" | |
def out_file_path(in_filename) | |
File.join(@out_path, File.dirname(in_filename), File.basename(in_filename, '.*') + '.' + @out_ext) | |
end |