Skip to content

Instantly share code, notes, and snippets.

%= javascript 'http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js';
#!/usr/bin/env perl
use Mojolicious::Lite;
app->hook(after_dispatch => sub {
my $c = shift;
$c->res->headers->header('Access-Control-Allow-Origin' => '*');
} );
my @refs = map
my $r = Buf[uint8].new(71, 69, 84, 32, 47, 32, 72, 84, 84, 80, 47, 49, 46, 49, 13, 10);
my $b = Buf[uint8].new(13, 10);
say $r.perl;
say $b.perl;
$r.append($b);
# "This representation (VMArray) cannot unbox to a native int
# in block <unit> at append.pl line 7"
/*
* CREATE EXTENSION pg_trgm;
*
* recursive portion taken directly from:
* http://www.postgresql.org/docs/9.5/static/queries-with.html
*/
WITH RECURSIVE search_graph(id, link, name, depth, path, cycle) AS (
SELECT g.id, g.link, g.name, 1,
ARRAY[g.id],
false
bduggan: wrk http://localhost:3333
Running 10s test @ http://localhost:3333
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 7.25ms 5.29ms 28.58ms 84.73%
Req/Sec 789.13 83.95 1.02k 68.00%
15853 requests in 10.09s, 1.25MB read
Requests/sec: 1570.58
Transfer/sec: 127.30KB
bduggan: wrk -t 5 http://localhost:3333
Running 10s test @ http://localhost:3333
5 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 136.11ms 248.76ms 1.30s 85.47%
Req/Sec 92.86 40.93 217.00 69.28%
3128 requests in 10.09s, 253.54KB read
Requests/sec: 309.93
Transfer/sec: 25.12KB
#!/usr/bin/env perl6
use v6;
# a webserver that is threaded with a 1 second timeout for clients
# but which does not impose a timeout on the (server) portion that
# is generating the response.
my $host = 'localhost';
my $port = 3333;
# casecmp should return 0 when strings are the same but different cases
bduggan: ruby -e "puts 'Reichwaldstraße'.casecmp('REICHWALDSTRASSE')"
1
bduggan: ruby -e "puts 'Ὀδυσσεύς'.casecmp('ὈΔΥΣΣΕΎΣ')"
1
bduggan: perl6 -e 'say fc("Reichwaldstraße") eq fc("REICHWALDSTRASSE")'
True
bduggan: perl6 -e "say fc('Ὀδυσσεύς') eq fc('ὈΔΥΣΣΕΎΣ')"
True
.say for "ask me","tell me","give me", "quiz me on"
X "some",""
X '{Level} {Category}'
X "math",""
X "questions","problems";
class X {
has Date(Str) $.day;
}
my $x = X.new(:day<2012-01-01>);