This file contains 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
sub _task { | |
my $self = shift; | |
my $coro_exit = 0; | |
my $wakeme = $Coro::current; | |
$self->{empty_count} = 0; | |
$self->{fetch_count} = 0; | |
my $num = $self->parallel_request_num; | |
# create fetcher coro | |
$self->create_request($num); |
This file contains 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
package OreOre::SQLMaker; | |
use strict; | |
use base qw(SQL::Abstract); | |
# $stmt = INSERT INTO table (col1, col2, col3) VALUES (?,?,?),(?,?,?) | |
# @bind = (val1, val2, val3, val21, val22, val23) | |
sub insert_multi { | |
my $self = shift; | |
my $table = shift; |
This file contains 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
var not_oquno = Array.filter(window.$("#following_list img"),function(img){return!/oquno/.test(img.src)}); | |
setInterval(function(){ | |
if (not_oquno.length == 0) return; | |
var i=Math.floor(Math.random()* not_oquno.length); | |
not_oquno[i].src="http://a3.twimg.com/profile_images/256862425/oquno-c_mini.png"; | |
not_oquno.splice(i, 1); | |
}, 1000); |
This file contains 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/perl | |
# http://todeskin.g.hatena.ne.jp/eigokun/20090902/1251903150 | |
# TODO: cache LWP response | |
use strict; | |
use URI; | |
use JSON; | |
use LWP::UserAgent; | |
use Web::Scraper; |
This file contains 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
use lib qw(../lib); | |
use Plack::Loader; | |
Plack::Loader->load("AnyEvent", port => 8888, host => "127.0.0.1")->run(\&handler); | |
sub handler { | |
my ( $env, $start_response ) = @_; | |
unless ($env->{psgi.async}) { | |
return [200, [], "Not Supported."] |
This file contains 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
use AnyEvent; | |
my $cv = AE::cv; | |
my $count = 0; | |
my $timer; | |
$timer = AE::timer 0, 0.1, sub { | |
$count++; | |
$cv->send("hoge" . $count); |
This file contains 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
package Plack::Middleware::AsyncSupport; | |
use strict; | |
use warnings; | |
use base qw/Plack::Middleware/; | |
our $USE_CORO = 1; | |
use Coro; | |
use Coro::Channel; | |
use IO::Handle::Util qw(io_from_getline); |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script type="text/javascript"> | |
chrome.browserAction.onClicked.addListener(function(tab){ | |
capture(); | |
}); |
This file contains 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
--- ares_init.c.old 2010-04-23 11:46:56.000000000 +0900 | |
+++ ares_init.c 2010-04-23 12:19:06.000000000 +0900 | |
@@ -831,12 +831,16 @@ | |
FILE *fp; | |
size_t linesize; | |
int error; | |
+ const char *path_resolv_conf = getenv("ARES_PATH_RESOLV_CONF"); | |
+ if (!path_resolv_conf) { | |
+ path_resolv_conf = PATH_RESOLV_CONF; | |
+ } |
This file contains 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/perl | |
use strict; | |
use Benchmark qw(:all); | |
use Data::Dumper; | |
use HTTP::Response; | |
use HTTP::Headers::Fast; | |
{ | |
package HTTP::Headers::Fast; | |
my %CACHE; |