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
--- Starting Benchmarks -------------------------------------------------------- | |
ETA: 30 benchmarks to run = 300 seconds minimum. | |
--- Template Benchmark @Wed Feb 11 12:11:15 2015 ------------------------------- | |
HT - HTML::Template (2.95) | |
HTE - HTML::Template::Expr (0.07) | |
MoTe - Mojo::Template () | |
TAHT - Template::Alloy (1.020) in HTML::Template mode | |
TATT - Template::Alloy (1.020) in Template::Toolkit mode | |
TATT_P - Template::Alloy (1.020) in Template::Toolkit mode (compile to | |
perl) |
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 warnings; | |
sub slurp { | |
my $file = shift; | |
open my $fh, '<', $file or die; | |
my @lines = <$fh>; | |
close $fh; | |
\@lines; |
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
events = require \events | |
EventEmitter = events.EventEmitter | |
P = require \bluebird | |
fifo = require \./app/shared/fifo | |
q = fifo.make! | |
ee = new EventEmitter | |
chain = P.resolve(true) | |
set-timeout (-> ee.emit \error, { +aaaa }), 500ms |
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/env perl | |
use strict; | |
use warnings; | |
use IPC::Open3; | |
use IO::Select; | |
use Symbol qw(gensym); | |
use POSIX qw(:sys_wait_h); | |
# Read as much as possible from a file handle and return the result. | |
# |
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/env perl | |
use strict; | |
use warnings; | |
use JSON; | |
while (<>) { | |
my $relay = decode_json $_; | |
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(int($relay->{coldTimestamp} / 1000)); | |
my $date = sprintf('%d-%02d-%02d', $year+1900, $mon+1, $mday); | |
print "$date $_" |
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 WhatIf; | |
use base 'Squatting'; | |
# Data in %state persists between requests. | |
our %state; | |
sub service { | |
my ($app, $c, @args) = @_; | |
my $cr = $c->cr; | |
my $sid = $cr->{session_id}; | |
if (defined $sid) { |
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 JGirl; # jgirl.com (after being liberated from domain squatters) | |
# | |
use strict; # Oh, the irony! | |
use warnings; #' | |
use base 'Squatting'; # <-----------------------------------' | |
use Encode; | |
our %CONFIG = ( | |
dbconnect => 'dbi:SQLite:dbname=jgirl.db', |
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
function (doc) { | |
// subset that doesn't contain current | |
var others = function(tags, current, length) { | |
var notCurrent = function(x) { return x != current; }; | |
if (length == 2) { | |
return tags.filter(notCurrent).map(function(n){ return [n] }); | |
} else { | |
var _others = []; | |
var list = tags.filter(notCurrent); | |
var size = length - 1; |
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 CouchWiki; | |
use strict; | |
use warnings; | |
use base 'Squatting'; | |
use Coro::AnyEvent; | |
our %CONFIG = ( | |
db => 'couchwiki' | |
); | |
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 UTF8; | |
use base 'Squatting'; | |
# == How to Run This App == | |
# | |
# squatting UTF8 | |
# squatting UTF8 -c view=raw | |
# squatting UTF8 -c view=as_subs | |
# | |