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(
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'
#!/usr/bin/env perl
###
use strict;
use warnings;
use 5.10.0;
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
# perl and coffee dual executable script. #
# for perl, take care no triple hash mark in script. #
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
#!/usr/bin/env perl
1 // <<X;
/*
X
use strict;
use warnings;
use 5.10.0;
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
# perl and node dual executable script. #