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 | |
#'$_ = $_.match(/^([A-Z][a-z]+)\s+([0-9]+)/) ? "#{$1}_#{$2}\n" : ""' head.log > date.log | |
class FileSplitter | |
attr_accessor :read_from, :logdir | |
def initialize(args) | |
@read_from, @logdir = args | |
@cur_m, @cur_d, @f = nil |
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 | |
path, from, to = $* | |
unless path && from && to | |
puts <<-__DESCRIPTION__ | |
./echo_between.rb file_path "from" "to" | |
snips large text file | |
command starts to print lines when matched "from" |
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 'webrick' | |
require 'optparse' | |
include WEBrick | |
OPTIONS = { | |
# :BindingAddress => '0.0.0.0', | |
:Port => 3000, |
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' | |
class Trac | |
def initialize(url) | |
@url = url | |
end | |
def newticket | |
@url + '/newticket' | |
end |
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
function not_empty(expr, msg) { | |
ok(function() { | |
if (! expr) { | |
return false; | |
} | |
// has length | |
else if (typeof expr['length'] == 'number') { | |
return expr.length > 0; | |
} | |
else { |
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 ShowHatenaBookmarkComment | |
// @namespace userjs.phphp.net | |
// @description build hatena bookmark comments | |
// @include http://* | |
// ==/UserScript== | |
/* Original Script: Hatena Bookmark Comments Viewer | |
* <http://www.ne.jp/asahi/nanto/moon/> | |
* <http://worris.sakura.ne.jp/hbcview.html> |
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
ps -xc|grep -sqi firefox && osascript <<'APPLESCRIPT' | |
tell application "Firefox" to activate | |
tell application "System Events" | |
if UI elements enabled then | |
keystroke "r" using command down | |
-- Fails if System Preferences > Universal access > "Enable access for assistive devices" is not on | |
else | |
-- Fails if Firefox is set to open URLs from external apps in new tabs. | |
-- tell app "Firefox" to Get URL "JavaScript:window.location.reload();" inside window 1 | |
tell application "Firefox" to get URL "JavaScript:window.location.reload();" |
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
<?php | |
/** | |
* #test prepare for the test | |
* <code> | |
* class User {}; | |
* function setup() { | |
* MockObject::setFixturePath(sfConfig::get('sf_test_dir') .'/fixtures/test_mock_object.yml', true); | |
* } | |
* | |
* </code> |
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
/** | |
* #test test_user | |
* <code> | |
* #diag('expect error'); | |
* try { | |
* $u = test_user('peko'); | |
* #fail('should raise error'); | |
* } | |
* catch(Exception $e) { | |
* #ok($e,$e->getMessage()); |
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
public static function getCriteria($c=null) | |
{ | |
if (! $c) { | |
$c = new Criteria; | |
} | |
return $c; | |
} | |
public static function retrieveBy($col, $value) | |
{ |
OlderNewer