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
/* | |
* for webkit (Safari4, Google Chrome2) bookmarklet | |
* | |
* javascript:(function(){var s=document.createElement("script");s.charset="UTF-8";s.src="http://gist.github.com/raw/156276/f7ef79b8da5514f44b84cf00367a92185747244d/gistfile1.js";s.onload=function(){_anim("div > * > * > * > *")};document.body.appendChild(s)})(); | |
*/ | |
window._anim = function _anim (selector) { | |
var elements = document.querySelectorAll(selector); | |
var s = document.createElement("script");s.charset="UTF-8"; |
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 sprintf = function (str) { | |
var args = Array.prototype.slice.call(arguments, 1); | |
return str.replace(/%0(\d+)d/g, function(m, num) { | |
var r = String(args.shift()); | |
var c = ''; | |
num = parseInt(num) - r.length; | |
while (--num >= 0) c += '0'; | |
return c + r; | |
}).replace(/%[sdf]/g, function(m) { return sprintf._SPRINTF_HASH[m](args.shift()) }); | |
}; |
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
__jsloader__ = function(scripts, callback, errorback) { | |
var now = (new Date()) - 0; | |
if (typeof errorback != 'function') | |
errorback = function(url) { alert('jsloader load error: ' + url) }; | |
var load = function(url) { | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.charset = 'utf-8'; |
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 String | |
def blize | |
self.split('').join('/') | |
end | |
end | |
# $KCODE = 'u' | |
# puts 'ちょよんご'.blize #=> ち/ょ/よ/ん/ご |
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
# Newbie programmer | |
$input=<>; | |
sub factorial { | |
$s=1; | |
$r=1; | |
while ($s <= $input) { | |
$r *= $s; | |
$s++; | |
} | |
if($input == 0) |
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 | |
class DigitConvertor | |
attr_reader :n | |
def initialize(chars) | |
@n = chars.size | |
@chars = chars | |
@chars_hash = Hash[*(@chars).zip((0..@n).to_a).flatten] | |
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
// ==UserScript== | |
// @name drag & drop fotolife uploader | |
// @namespace http://rails2u.com/* | |
// @description フォトライフでローカルファイルから drag & drop でファイルアップロード (HTML5 File API 対応ブラウザのみ) | |
// @include http://f.hatena.ne.jp/*/up* | |
// ==/UserScript== | |
var upForm = document.getElementById('upload'); | |
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
// ==UserScript== | |
// @name Firefox to Phone | |
// @namespace http://rails2u.com/ | |
// @description Send to Android phone | |
// @include http://* | |
// @include https://* | |
// ==/UserScript== | |
/* | |
* Original code by http://code.google.com/p/chrometophone/ |
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
// LDRize (c) id:snj14 | |
function addStyle(css, id){ // GM_addStyle is slow | |
var link = document.createElement('link'); | |
link.rel = 'stylesheet'; | |
link.href = 'data:text/css,' + escape(css); | |
document.documentElement.childNodes[0].appendChild(link); | |
} |
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 | |
require 'rubygems' | |
require 'pathname' | |
gem 'bundler' | |
require 'bundler' | |
files = Bundler.load.specs.map do |spec| | |
path = Pathname.new(spec.full_gem_path) | |
spec.lib_files.map {|file| path.join(file).to_s } |