Skip to content

Instantly share code, notes, and snippets.

@kei-s
kei-s / ShowTwitterIconOnTumblrBySTOT.user.js
Created July 30, 2008 06:53
ShowTwitterIconOnTumblerBySTOT
// ==UserScript==
// @name ShowTwitterIconOnTumblerBySTOT
// @namespace http://libelabo.jp/
// @description Show twitter icon in conversation posted by ShareTwitterOnTumblr
// @author kei-s
// @include http://*.tumblr.com/*
// ==/UserScript==
(function(){
var WIDTH = "30";
@kei-s
kei-s / twitter-timeline-ubiquity
Created August 29, 2008 11:17
ubiquity twitter-timeline
CmdUtils.CreateCommand({
name: "twitter-timeline",
description: "Browse Twitter Timeline",
preview: function(pblock, directObject) {
var twitterHome = "http://twitter.com/home";
jQuery.get( twitterHome, {}, function(data) {
CmdUtils.loadJQuery(function(){
pblock.innerHTML = window.$("#timeline",data).html();
});
}, "html");
@kei-s
kei-s / pager.rb
Created December 3, 2008 12:19 — forked from june29/pager.rb
crawl AutoPagerize NextLink
require "rubygems"
require "nokogiri"
require "httpclient"
require "uri"
require "json"
class Pager
@@siteinfo_url = "http://wedata.net/databases/AutoPagerize/items.json"
attr_accessor :doc
@kei-s
kei-s / motsu_tabetai.user.js
Created December 16, 2008 18:11 — forked from youpy/motsu_tabetai.user.js
motsu when submit form
// ==UserScript==
// @name Motsu Tabetai
// @namespace http://ikenie.com/
// @include *
// @require http://gist.github.com/raw/3242/1a7950e033a207efcfc233ae8d9939b676bdbf46
// @require http://gist.github.com/raw/34615/04333b7e307eb029462680e4f4cf961f72f4324c
// ==/UserScript==
(function() {
var DATABASE_URL = 'http://wedata.net/databases/Motsu/items.json';
@kei-s
kei-s / Array.prototype.sortByParams.js
Created January 6, 2009 15:43
Array.prototype.sortByParam
Array.prototype.sortByParam = function(param) {
return this.sortByParams([param]);
};
Array.prototype.sortByParams = function() {
var params = arguments[0];
if( !params
|| (!params.length || params.length == 0)
|| typeof params !== 'object'
|| !params.constructor
|| params.nodeType
@kei-s
kei-s / word_count.rb
Created March 21, 2009 12:26
word count
open('oreilly_web_20.txt').read.
scan(/[^)(:;$*"@'>!\?\/,\s-]+/).
map{|word| word.sub(/\.$/,'').downcase }.
reject{|word| word.empty? }.
inject(Hash.new(0)) { |hash, word|
hash[word] += 1
hash
}.sort{|a, b|
(b[1] <=> a[1]) * 2 + (a[0] <=> b[0])
}.each do |array|
@kei-s
kei-s / CharacterReference.js
Created April 23, 2009 14:22
(encode || decode) character reference
function decode(line) {
return line.replace(/&([#0-9a-zA-Z]+?);/g,function(entity,code){
if (/^#[0-9]+$/.test(code)) {
return String.fromCharCode(code.slice(1));
}
if (/^#x[0-9a-fA-F]+$/.test(code)) {
return String.fromCharCode(parseInt(code.slice(2),16));
}
return referenceMap[code] ? String.fromCharCode(referenceMap[code]) : entity;
});
@kei-s
kei-s / ext_nicovideo
Created April 28, 2009 17:17
nicovideo swf API
ext_play(Boolean):void
ext_setPlayheadTime(Number):void
ext_setMute(Boolean):void
ext_setVolue(Boolean):void
ext_setCommentVisible(Boolean):void
ext_setRepeat(Boolean):void
ext_setVideoSize(string):void
ext_isMute():Boolean
ext_getVolume():number
ext_isCommentVisible():Boolean
@kei-s
kei-s / saykana.rb
Created June 19, 2009 02:44
saykana
#!/usr/bin/env ruby
# vim:fileencoding=utf-8
require 'MeCab'
require 'kakasi'
require 'kconv'
require 'uri'
# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/33639
class String