Skip to content

Instantly share code, notes, and snippets.

View darashi's full-sized avatar

Yoji Shidara darashi

View GitHub Profile
makeSearchCommand({
name: "buzztter",
url: "http://buzztter.com/ja/k/{QUERY}",
icon: "http://buzztter.com/favicon.ico",
description: "Searches <a href=\"http://buzztter.com/ja/\">buzztter (in Japanese)</a> for your words.",
preview: function(pblock, directObject){
var searchTerm = directObject.text;
var pTemplate = "Searches <a href=\"http://buzztter.com/ja/\">buzztter (in Japanese)</a> for <b>${query}</b>.";
var pData = {query: searchTerm};
pblock.innerHTML = CmdUtils.renderTemplate(pTemplate, pData);
function SBM() {}
SBM.prototype = {
initialize : function(pblock, url) {
this._pblock = pblock;
this._url = url;
this._div_id = this._id + "-results";
},
displayResult : function(result) {
jQuery("#"+this._div_id, this._pblock)[0].innerHTML = result ?
result : "no bookmarks with comment";
// ==UserScript==
// @name gist-ubiquitifier
// @namespace http://d.hatena.ne.jp/darashi
// @description adds link to Gist Ubiquitifier on gist
// @include http://gist.github.com/*
// @include https://gist.github.com/*
// @version 0.0.0
// ==/UserScript==
var target = document.getElementById("gist_meta");
makeSearchCommand({
name: "friendfeed-search",
url: "http://friendfeed.com/search?q={QUERY}",
icon: "http://friendfeed.com/favicon.ico",
description: "Searches <a href=\"http://friendfeed.com\">FriendFeed</a> for your words."
});
#!/usr/bin/ruby
i = 0
founds = 0
begin
i += 1
sq = i ** 2
digits = Math.log10(sq).to_i + 1
next if digits % 2 == 1
m = 10**(digits/2)
@darashi
darashi / sapica.rb
Created January 31, 2009 03:26
http://www.sapica.jp から SAPICA 利用履歴を取得するスクリプト
#!/usr/bin/env ruby1.9
require 'rubygems'
require 'pit'
require 'nokogiri'
require 'mechanize'
config = Pit.get('sapica', :require => {
'cardid' => 'your card id',
'password' => 'your password'
@darashi
darashi / sapica_csv2kml.rb
Created February 28, 2009 07:37
SAPICA履歴をKMLに変換する
#!/usr/bin/env ruby1.9
# encoding: utf-8
require 'cgi'
require 'open-uri'
require 'rubygems'
require 'nokogiri'
require 'pit'
appid = Pit.get('ydn', :require => {
@darashi
darashi / workshops_at_sapporo.rb
Created March 14, 2009 11:37
札幌で開催される勉強会を抽出する
#!/usr/bin/env ruby1.9
# encoding: utf-8
require 'open-uri'
require 'rubygems'
require 'icalendar'
uri = "http://www.google.com/calendar/ical/fvijvohm91uifvd9hratehf65k%40group.calendar.google.com/public/basic.ics"
@darashi
darashi / saybot.rb
Created March 20, 2009 13:16
irc say bot (for OSX)
#!/usr/bin/env ruby1.9
require 'logger'
require 'rubygems'
require 'net/irc'
class IrcClient < Net::IRC::Client
def initialize(*args)
super
@darashi
darashi / git_commit_header.rb
Created May 20, 2009 11:44
add X-Git-Commit header to Rack application
# Rack middleware to insert git commit id into http response header
# For Rails, put this script under RAILS_ROOT/config/initializers
module Rack
class GitCommitHeader
def initialize(app)
@app = app
c = `git rev-parse HEAD`.chomp
@commit = (c =~ /^[0-9a-f]{40}$/) ? c : nil
end