This file contains hidden or 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
def capture(stream) | |
begin | |
stream = stream.to_s | |
eval "$#{stream} = StringIO.new" | |
yield | |
result = eval("$#{stream}").string | |
ensure | |
eval("$#{stream} = #{stream.upcase}") | |
end | |
result |
This file contains hidden or 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
# http://qiita.com/ToQoz/items/848abdf90a0f40e70ce0 | |
# http://stackoverflow.com/questions/3063507/list-goals-targets-in-gnu-make/9524878#9524878 | |
_makefile_cache_updated_at() { | |
echo $(stat .make_targets -c%Y) | |
} | |
_makefile_updated_at() { | |
echo $(stat Makefile -c%Y) | |
} | |
_generate_makefile_cache() { | |
[ -f .make_targets ] && rm .make_targets |
This file contains hidden or 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 'open-uri' | |
require 'json' | |
READ_START_SYMBOL = '# ---auto update---' | |
READ_END_SYMBOL = '# ---/auto update---' | |
def notify(name, from, to) | |
puts "update #{name} from #{from} to #{to}" | |
end |
This file contains hidden or 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
local sprite = CCSprite:create("hoge.png") | |
sprite:setTouchEnabled(true) | |
sprite:addTouchEventListener(function(event, x, y) | |
if event == "began" then | |
return true | |
elseif event == "moved" then | |
elseif event == "ended" then | |
end | |
end) |
This file contains hidden or 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
set showmatch " 括弧の対応をハイライト | |
set number " 行番号表示 | |
set list " 不可視文字表示 | |
set listchars=tab:>.,trail:_,extends:>,precedes:< " 不可視文字の表示形式 | |
set display=uhex " 印字不可能文字を16進数で表示 | |
set previewheight=15 " プレビュー画面サイズ | |
set cmdheight=1 " コマンドラインに使われる画面上の行数 | |
set lazyredraw " コマンド実行中は再描画しない | |
set ttyfast " 高速ターミナル接続を行う | |
set cursorline " カーソル行をハイライト |
This file contains hidden or 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
#------------------------------------ | |
# options configuration | |
# ------------------------------------ | |
# 指定したコマンド名がなく、ディレクトリ名と一致した場合 cd する | |
setopt auto_cd | |
# cd でTabを押すとdir list を表示 | |
setopt auto_pushd | |
# ディレクトリスタックに同じディレクトリを追加しないようになる | |
setopt pushd_ignore_dups | |
# コマンドのスペルチェックをする |
This file contains hidden or 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
#MysqlでFKの一覧を調べるワンライナー | |
mysql -u resolver --password=resolver resolver < TableList.sql |sed 's/\\n/&\ | |
/g'| grep 'CONSTRAINT .* FOREIGN KEY'|cut -d ' ' -f4 > FKList | |
# ファイル名を置換するワンライナー | |
ls *.png | cut -d ' ' -f14,15,16,17 |perl -nle '$o=$_;$_=~s/\s/_/i;$_=lc($_);$_=~s/^/icon_/i;rename($o, $_);' | |
ls *.png | cut -d ' ' -f14,15,16,17 |perl -nle '$o=$_;$_=~s/\s/_/i;$_=lc($_);$_=~s/^/button_/i;rename($o, $_);' |
This file contains hidden or 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 'fileutils' | |
GEMFILE_TMP = 'Gemfile_tmp' | |
FileUtils.cp('Gemfile', GEMFILE_TMP) | |
regex = /^\s*gem ['"]([-\w]+)['"](,.*)?/ | |
gems = File.read(GEMFILE_TMP).scan(regex).map do |g| | |
g.first if g.last.nil? | |
end |
This file contains hidden or 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
// ==UserScript== | |
// @name Nico Link | |
// @version 0.1 | |
// @description Niconico video home link | |
// @include http://www.nicovideo.jp/watch/* | |
// ==/UserScript== | |
(function(){ | |
var sc = document.getElementById('videoHeaderMenu').getElementsByClassName('searchContainer').item(0); | |
var l = document.defaultView.getComputedStyle(sc, ':before'); |
This file contains hidden or 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
// ==UserScript== | |
// @name Nico Nico Enhance | |
// @version 0.1 | |
// @description Nico Nico Enhance | |
// @include *://www.nicovideo.jp/watch/* | |
// ==/UserScript== | |
(function(){ | |
try{ | |
// document.getElementById('PlayerContainer').focus(); |