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 'sinatra' | |
require 'oauth' | |
require 'twitter' | |
helpers do | |
include Rack::Utils | |
alias_method :h, :escape_html | |
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
# NOTE: | |
# This version is out-of-date. | |
# Please access http://github.com/maraigue/devnull for the versions under development. | |
# Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows) | |
# (C) 2010- H.Hiro(Maraigue) [email protected] | |
# | |
# DevNull works like an IO object. For example: | |
# dn = DevNull.new | |
# dn.puts "foo" # => nil (do nothing) |
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
# sinatra でのリダイレクト設定 | |
# hoge/ のような '/' 終わりを '/' 無しへリダイレクト | |
# ただし、 http://example.com の場合は末尾 '/' が付く | |
get %r{^(.+)/$} do |c| | |
redirect c, 303 | |
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
# sinatra でのリダイレクト設定 | |
# http://.../hoge のような '/' なしを '/' ありへリダイレクト | |
# ただし、 http://example.com の場合は末尾 '/' が付く | |
get %r{^(.+[^/])$} do |c| | |
redirect c + "/", 303 | |
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
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); | |
} |
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
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 |
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 'json' | |
require 'net/telnet' | |
target_url = "http://www.jewelpet.jp/" | |
prompt = /^repl> / | |
INJECT_JS = <<EOS | |
repl.print( (function(doc){ | |
var _j = function(s) { |
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 'drb' | |
require 'pp' | |
require 'net/https' | |
require 'oauth' | |
require 'json' | |
class JSONStream | |
def initialize(drop) | |
@buf = '' | |
@drop = drop |
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
#!/usr/bin/env macruby | |
# | |
# MacRubyで画面グリッチをフルスクリーン表示する | |
# | |
# http://twitter.com/negipo/status/67572370247913473 | |
# | |
# ## Usage | |
# | |
# ./glitch.rb | |
# |
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
#!/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" |
OlderNewer