- Scott Chacon on the Interwebs(リンク切れ)
- Scott Chacon on the Interwebs
- GitHub Flow - The best way to use Git and GitHub
31 Aug 2011
| #!/usr/bin/env ruby | |
| SOI = "\xff\xd8" | |
| APP0 = "\xff\xe0" | |
| DQT = "\xff\xdb" | |
| DHT = "\xff\xc4" | |
| SOF0 = "\xff\xc0" | |
| SOS = "\xff\xda" | |
| EOI = "\xff\xd9" |
| #!/usr/bin/env macruby | |
| # | |
| # MacRubyで画面グリッチをフルスクリーン表示する | |
| # | |
| # http://twitter.com/negipo/status/67572370247913473 | |
| # | |
| # ## Usage | |
| # | |
| # ./glitch.rb | |
| # |
| require 'drb' | |
| require 'pp' | |
| require 'net/https' | |
| require 'oauth' | |
| require 'json' | |
| class JSONStream | |
| def initialize(drop) | |
| @buf = '' | |
| @drop = drop |
| require 'rubygems' | |
| require 'json' | |
| require 'net/telnet' | |
| target_url = "http://www.jewelpet.jp/" | |
| prompt = /^repl> / | |
| INJECT_JS = <<EOS | |
| repl.print( (function(doc){ | |
| var _j = function(s) { |
| command! -nargs=+ lazy autocmd VimperatorEnter .* <args> | |
| lazy fmaps -urls='^http://twitter\.com/' j k ? | |
| lazy fmaps -urls='^http://twitter\.com/' -events=vkeydown n m t r gh gr gp gf gm |
| js <<EOM | |
| // <c-x> | |
| (function() { | |
| liberator.modules.mappings.addUserMap([liberator.modules.modes.COMMAND_LINE], ['<c-x>'], | |
| "insert current URL to command line", | |
| function () { | |
| var curcmd = ':' + commandline.command; | |
| if (!curcmd.match(/ $/)) curcmd += ' '; | |
| commandline.open(curcmd, liberator.modules.buffer.URL); | |
| } |
| # sinatra でのリダイレクト設定 | |
| # http://.../hoge のような '/' なしを '/' ありへリダイレクト | |
| # ただし、 http://example.com の場合は末尾 '/' が付く | |
| get %r{^(.+[^/])$} do |c| | |
| redirect c + "/", 303 | |
| end |
| # sinatra でのリダイレクト設定 | |
| # hoge/ のような '/' 終わりを '/' 無しへリダイレクト | |
| # ただし、 http://example.com の場合は末尾 '/' が付く | |
| get %r{^(.+)/$} do |c| | |
| redirect c, 303 | |
| end |