Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View aklaswad's full-sized avatar

Akira Sawada aklaswad

View GitHub Profile
exponent setup from center value for live.dial
<pre><code>
----------begin_max5_patcher----------
2443.3oc6b07aiaqD+bVf8+ABibnaahi3WhRsGKdGemd8V2hEJNzwp0RxPRN
aBJd+uWQNTxRw1TLwTqyFzcQh7HIaM+FNeyw4u+3GtX1sEOJqlg9Yzuit3h+
t4LWnOm5LWzdhKlkk73h0IU5ab1hhrLYd8rqLWrV9Xs9B+1pzJzlj5EqjknM
kE2lb65mPqRpPInMxxkEkYI4Kj5KsVlgRpQqKxuGUmlIQaqjyQ+Oor6iMeaV
Z9ZYs9gh6c1hs0smNn8zo2o4fha+yqw3ntOCMyjle+WJkKpATRIz4AWgXDh9
PXn5.IXd.5Ozuo++G+f5XygqNcIxxxhLTQsRdPQOjrdair9zwWnM7wvBMvhm
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Data::ObjectDriver::Driver::DBI;
use Parallel::ForkManager;
sub main {
# Init dbh and make sure it was connected by parent process
my $driver = Data::ObjectDriver::Driver::DBI->new(
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 10;
use Data::ObjectDriver::Driver::DBI;
use Parallel::ForkManager;
sub main {
# Init dbh and make sure it was connected in parent process
my $driver = Data::ObjectDriver::Driver::DBI->new(
@aklaswad
aklaswad / script.js
Last active August 29, 2015 14:15
JavaScript editable/runnable perl server script
1 // <<HACK;
/*
HACK
use strict;
use warnings;
use Plack::Runner;
my $js = do { local $/; <DATA> };
my $html = <<'HTML';
@aklaswad
aklaswad / server.pl
Last active August 29, 2015 14:15
Perl-JS compatible webserver
#!/usr/bin/env perl
1 // <<HACK;
/*
HACK
use strict;
use warnings;
use Plack::Runner;
my $js = do { local $/; <DATA> };
use strict;
use warnings;
# find the most greater value in range of less or equal to given target.
# returns the index of that value.
# array must be ascend sorted.
sub idx_of_max_in {
my ( $array, $head, $tail, $target ) = @_;
return $tail if $array->[$tail] <= $target;
return $head if $array->[$head] == $target;
use strict;
use warnings;
my $PRICE_MAX = 1_000_000;
my $PRICE_MIN = 10;
my $ALGORITHM_SWITCH_THRESHOLD = 1000; # TODO: 適当に決めるな馬鹿
my @lines = split "\n", do { local $/; <> };
my ( $num_products, undef ) = split( " ", shift(@lines) );
my @prices = splice( @lines, 0, $num_products );
use strict;
use warnings;
my $PRICE_MAX = 1_000_000;
my @lines = split "\n", do { local $/; <> };
my ( $num_products, undef ) = split( " ", shift(@lines) );
my @prices = splice( @lines, 0, $num_products );
my @hist;
var async_task = function (msg, delay) {
var dfd = $.Deferred();
setTimeout( function () {
if ( msg !== 'l' ) {
dfd.resolve('resolved:' + msg);
}
else {
dfd.reject('rejected:' + msg);
}
@aklaswad
aklaswad / gist:4117045
Created November 20, 2012 09:54
fullscreen api wrapper draft
(function ($) {
var venderApis = {
'fullscreenEnabled': {
request: 'requestFullscreen'
, exit: 'exitFullscreen'
, element: 'fullscreenElement'
}
, 'mozFullScreenEnabled': {
request: 'mozRequestFullScreen'