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 'rubygems' | |
| require 'sinatra' | |
| # doesn't work on thin and webrick | |
| set :server, 'mongrel' | |
| get '/' do | |
| boundary = 'ThisRandomString' | |
| response['Content-Type'] = 'multipart/x-mixed-replace;boundary=' + boundary |
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 'rubygems' | |
| require 'sinatra' | |
| # doesn't work on thin and webrick | |
| set :server, 'mongrel' | |
| get '/' do | |
| <<HTML | |
| <html> | |
| <head> |
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
| module Rack | |
| class Glitch | |
| def initialize(app, options = {}) | |
| @app = app | |
| end | |
| def call(env) | |
| status, headers, response = @app.call(env) | |
| if headers['content-type'] =~ /jpeg/ |
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 'rubygems' | |
| require 'tidy' | |
| module Rack | |
| class CleanHTML | |
| def initialize(app, options = {}) | |
| options = options.dup | |
| Tidy.path = options.delete(:tidy_path) |
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 'rubygems' | |
| require 'sinatra' | |
| require 'open-uri' | |
| # doesn't work on thin and webrick | |
| set :server, 'mongrel' | |
| get '/' do | |
| boundary = 'ThisRandomString' | |
| response['Content-Type'] = 'multipart/x-mixed-replace;boundary=' + boundary |
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 make b.hatena.jp/youpy usable | |
| // @namespace http://d.hatena.ne.jp/youpy/ | |
| // @include http://b.hatena.ne.jp/youpy* | |
| // @require https://raw.github.com/gist/3242/62166dfb4126bfd1b26ba586551fe96c469aec77/dollarX.js | |
| // ==/UserScript== | |
| $X('//style')[0].innerHTML = ''; |
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
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'pit' | |
| require 'scissor/echonest' | |
| config = Pit.get('echonest.com', :require => { | |
| 'api_key' => 'your Echo Nest API key' | |
| }) | |
| Scissor.echonest_api_key = config['api_key'] |
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
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'pit' | |
| require 'gdata' | |
| title = 'ieijiroflashcards' | |
| config = Pit.get('google.com', :require => { | |
| 'username' => 'your google.com username', | |
| 'password' => 'your google.com password' | |
| }) |
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
| ;; kill ring をOSX のクリップボードと共有 | |
| ;; http://blog.lathi.net/articles/2007/11/07/sharing-the-mac-clipboard-with-emacs | |
| ;; http://d.hatena.ne.jp/edvakf/20080929/1222657230 | |
| (defun copy-from-osx () | |
| ;; (shell-command-to-string "pbpaste")) | |
| (shell-command-to-string "__CF_USER_TEXT_ENCODING=0x$(printf %x $(id -u)):0x08000100:14 pbpaste | nkf -W")) | |
| (defun paste-to-osx (text &optional push) | |
| (let ((process-connection-type nil)) | |
| ;; (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy"))) |
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
| #!/usr/bin/env ruby | |
| # usage: git-commit-as github-username -m 'commit message' | |
| require 'open-uri' | |
| require 'rexml/document' | |
| def main | |
| username = ARGV.shift | |
| userid = userid(username) |