Skip to content

Instantly share code, notes, and snippets.

@wtnabe
wtnabe / linkchecker_i18n_hack.diff
Created June 29, 2009 23:56
A i18n patch for linkchecker 2.5 installed by Fink (MacOSX).
--- site-packages/linkcheck/i18n.py.org 2007-03-22 04:29:01.000000000 +0900
+++ site-packages/linkcheck/i18n.py 2009-06-30 08:52:04.000000000 +0900
@@ -26,7 +26,7 @@
# more supported languages are added in init()
supported_languages = ['en']
default_language = 'en'
-default_encoding = locale.getpreferredencoding()
+default_encoding = 'utf_8'
# It can happen that the preferrec encoding is not determinable, which
# means the function returned None. Fall back to ASCII in this case.
@wtnabe
wtnabe / jquery_onload.js
Created July 9, 2009 21:23
jQuery's "$" wrapper
jQuery(document).ready(function($) {
..
});
@wtnabe
wtnabe / adjust_lib_path.rb
Created August 11, 2009 09:20
A tip for simply writing "require LIB", in gem's bin/script
#
# for gem's bin/script
#
unless ( ENV['PATH'].split( File::PATH_SEPARATOR ).include?( File.dirname( __FILE__ ) ) )
$LOAD_PATH << File.expand_path( "../lib", File.dirname( __FILE__ ) )
end
@wtnabe
wtnabe / which.rb
Created August 11, 2009 14:21
"which" command Ruby implementation
#! /usr/bin/env ruby
def which( cmd, *additional )
paths = ENV['PATH'].split( File::PATH_SEPARATOR )
paths += additional if additional
path = paths.map { |d|
file = File.join( d, cmd )
( File.exist?( file ) ) ? file : nil
}.compact.first
@wtnabe
wtnabe / god_growl.rb
Created August 17, 2009 03:14
growl notifier for God
require 'ruby-growl'
module God
module Contacts
class GodGrowl < Contact
def notify( message, time, priority, category, host )
priority = 0 if ( !priority )
if ( !@growl )
@growl = Growl.new( 'localhost', 'God', ['test'] )
end
@wtnabe
wtnabe / simple.god.diff
Created August 17, 2009 03:16
A patch of God's simplest sample with Growl notify
diff --git a/simple.god b/simple.god
index 407e34b..3ca0518 100644
--- a/simple.god
+++ b/simple.god
@@ -1,4 +1,12 @@
+# -*- mode: ruby -*-
+
+require File.dirname( __FILE__ ) + '/../god_extension/god_growl'
+
#The simplest possible watch
@wtnabe
wtnabe / popup-nifty-clip.js
Created September 10, 2009 01:27
A bookmarklet for nifty clip with popup window
javascript:(function(){w=window.open(location.href,'nifty_clip','scrollbars=yes,width=550,height=600');setTimeout(function(){var%20s=w.document.createElement('script');s.charset='utf-8';s.src='http://clip.nifty.com/toolbar/addclip/bookmarklet.js';w.document.body.appendChild(s)},2000)})();
@wtnabe
wtnabe / popup-nifty-clip.css
Created September 10, 2009 01:27
A user css for nifty clip
@-moz-document url-prefix("http://clip.nifty.com/create?url=") {
#headLogo {
display: none !important;
}
#headBanner {
display: none !important;
}
#subContents {
display: none !important;
}
@wtnabe
wtnabe / popup-livedoor-clip.user.js
Created September 10, 2009 10:14
A bookmarklet for livedoor clip with popup window
javascript:(function(){window.open('http://clip.livedoor.com/clip/add?link='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title),'livedoor_clip','width=550,height=600')})();
@wtnabe
wtnabe / popup-livedoor-clip.user.css
Created September 10, 2009 10:15
A user css for making livedoor clip compact
@-moz-document url-prefix("http://clip.livedoor.com/clip/add?link=") {
#addclipttl {
margin: 5px !important;
}
form[name="clip"] {
width: 500px !important;
margin-left: 10px !important;
}
div#AddClipsBox {
width: 500px !important;