Skip to content

Instantly share code, notes, and snippets.

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);
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;
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);
#!/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;
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."]
use AnyEvent;
my $cv = AE::cv;
my $count = 0;
my $timer;
$timer = AE::timer 0, 0.1, sub {
$count++;
$cv->send("hoge" . $count);
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);
@mala
mala / background.html
Created March 10, 2010 11:49
presen to jpg extension
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript">
chrome.browserAction.onClicked.addListener(function(tab){
capture();
});
--- 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;
+ }
#!/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;