This file contains hidden or 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/env perl -l | |
use strict; | |
use warnings; | |
# fx:=x+1; | |
sub f { | |
local $_ = shift; | |
$_+1; | |
} | |
print f(3); |
This file contains hidden or 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/env perl -l | |
use strict; | |
use warnings; | |
sub memorize { | |
my $fib = shift; | |
my @list = (); | |
sub { | |
local $_ = shift; | |
$list[$_] or $list[$_] = $fib->($_); |
This file contains hidden or 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
MeCabインストールメモ | |
$HOME に MeCab をインストールする | |
※ [参照] [http://kawa.at.webry.info/201110/article_2.html:title=形態素解析 MeCab を Perl モジュール Text::MeCab から使う Kawanet Tech Blog/ウェブリブログ] | |
---- | |
1. MeCab本体: http://downloads.sourceforge.net/project/mecab/mecab/0.98/mecab-0.98.tar.gz | |
2. MeCab辞書: http://downloads.sourceforge.net/project/mecab/mecab-ipadic/2.7.0-20070801/mecab-ipadic-2.7.0-20070801.tar.gz | |
3. PerlのMeCabドライバ(Text::MeCab): | |
---- |
This file contains hidden or 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/env perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use AnyEvent; | |
use AnyEvent::HTTP; | |
use Config::Pit; | |
use Web::Scraper; | |
use File::Basename; |
This file contains hidden or 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 MyApp::AnyEvent::FriendFeed; | |
use strict; | |
use warnings; | |
use Carp; | |
use AnyEvent; | |
use AnyEvent::HTTP; | |
use MIME::Base64; | |
use HTTP::Request::Common; | |
use HTTP::Request; |
This file contains hidden or 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
if (! Array.prototype.filter) { | |
Array.prototype.filter = function (patternFunc) { | |
var helper = function (thisArray, newArray) { | |
if (! newArray) newArray = []; | |
if (thisArray && thisArray.length > 0) { | |
var el = thisArray.shift(); | |
if (patternFunc(el)) newArray.push(el); | |
return helper(thisArray, newArray); | |
} |
This file contains hidden or 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 EvEm = require('events').EventEmitter; | |
function Timer (interval, defaultFunc) { | |
this.count = 0; | |
this.interval = interval || 1000; // 1秒デフォルト | |
this.eventsList = {}; | |
this.default = defaultFunc || function (c) { console.log(c); }; | |
}; | |
(function (_tp) { |
This file contains hidden or 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 AnyEvent::Tabelog::Search; | |
use strict; | |
use utf8; | |
use Carp; | |
use URI; | |
use AnyEvent; | |
use AnyEvent::HTTP qw(http_request); | |
use XML::Simple; | |
our $VERSION = '0.01'; |
This file contains hidden or 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/env perl -l | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
sub fold { | |
my $f = shift; | |
my $res = shift; | |
my @rest = @_; |
This file contains hidden or 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
function findSequence (goal) { | |
var find = function (start, history) { | |
return (start === goal) ? history : | |
(start > goal) ? null : | |
find(start + 5, "(" + history + " + 5)") || | |
find(start * 3, "(" + history + " * 3)"); | |
}; | |
return find(1, '1'); | |
} |