Skip to content

Instantly share code, notes, and snippets.

View kyanny's full-sized avatar

Kensuke Nagae kyanny

View GitHub Profile
describe "App.request", ->
deferred = null
beforeEach ->
sinon.stub(App, "request").yieldsTo('done', {res: "ok"})
afterEach ->
App.request.restore()
@kyanny
kyanny / pipe.rb
Last active December 18, 2015 17:08 — forked from fujimura/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
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");
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
@kyanny
kyanny / jquery_patch.pl
Created June 24, 2011 03:19 — forked from mala/jquery_patch.pl
quick patch script for jQuery http://bugs.jquery.com/ticket/9521
#!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\-]*)$)/};
@kyanny
kyanny / gist:946249
Created April 28, 2011 12:25
webscraper
#!/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';
};
@kyanny
kyanny / gist:568601
Created September 7, 2010 16:13 — forked from anonymous/gist:555061
LISP365のリンクを作る
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>')})();
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) {