View pipe.rb
class Object | |
def pipe | |
yield self | |
end | |
end | |
# From https://github.com/rspec/rspec-rails/pull/766/files | |
# Without Object#pipe | |
types = begin |
View Sekigae.java
import java.util.ArrayList; | |
import java.util.Collections; | |
public class Sekigae{ | |
public static void main(String[] args){ | |
ArrayList<String> list = new ArrayList<String>(); | |
list.add("okkun"); | |
list.add("kitak"); |
View dynamic_worker_class.rb
module Foo | |
module_eval do | |
host_name = `hostname`.chomp | |
host_name_short = `hostname -s`.chomp | |
queue_name = "#{host_name}" | |
# mod = Module.new | |
# mod.module_eval %Q{ | |
# @queue = :abc #host_name | |
# def self.perform |
View jquery_patch.pl
#!perl | |
# perl jquery_patch.pl jquery-n.nn.min.js > jquery-n.nn.min.patched.js | |
$old = join "|", map quotemeta, ( | |
q{/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/}, | |
q{/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/}, | |
q{/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/} | |
); | |
$new = q{/^(?:\s*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/}; |
View gist:946249
#!/home/kyanny/perl5/perlbrew/perls/perl-5.12.2/bin/perl | |
use strict; | |
use Web::Scraper; | |
use URI; | |
use YAML; | |
my $uri = URI->new("http://chat.studio.cx/o-cha/jsp/superbeginner/enter.php"); | |
my $scraper = scraper { | |
process 'form input', 'list[]' => '@name'; | |
}; |
View gist:568601
javascript:(function(){var d=new Date(); alert("%E3%80%90" + [d.getYear()+1900,d.getMonth()+1,d.getDate()].join('/') + '%E3%80%91' + '<a href="' + location + '">' + document.title + '</a>')})(); |
View days-eyefi-uploader.pl
use strict; | |
use warnings; | |
my $API_USERNAME = $ENV{DAYS_USERNAME}; | |
my $API_PASSWORD = $ENV{DAYS_EYEFI_PASSWORD}; | |
my $API_ENDPOINT = 'http://30d.jp/manage/library/main.php'; | |
my $filepath = $ARGV[0]; | |
unless ($API_PASSWORD && $filepath) { |
View deferred_spec.coffee
describe "App.request", -> | |
deferred = null | |
beforeEach -> | |
sinon.stub(App, "request").yieldsTo('done', {res: "ok"}) | |
afterEach -> | |
App.request.restore() |