Skip to content

Instantly share code, notes, and snippets.

View tene's full-sized avatar

Stephen Weeks tene

  • Sunnyvale, CA
View GitHub Profile
#!/usr/bin/perl
package Garden::Templates;
use Template::Declare::Tags;
use base 'Template::Declare';
use Data::Dumper;
template index => sub {
my $self = shift;
my $r = shift;
use strict;
sub handler {
print "lol i died\n";
}
BEGIN {
$SIG{__DIE__} = &handler;
}
$foo = "lol";
sub myX(@a, @b) {
my $i = 0;
return gather {
while $i < [@a.elems, @b.elems].min {
take (@a[$i], @b[$i]);
$i++;
take (@a[$i] X @b[0..^$i]);
take (@a[0..^$i] X @b[$i]);
}
}
#!/usr/bin/perl
use strict;
use Text::Balanced qw/extract_bracketed/;
use Data::Dumper;
my $in = $ARGV[0] || '(a.b.(foo|bar|baz).(lol|wtf|bbq))|frob';
my @all_assets;
print "given: $in\n\n";
multi sub MAIN($source, *@files, :$debug, :$preserve, :$fancy) {
...
}
multi sub MAIN($source, $dest) {
...
}
multi sub do-stuff(Str $fn where { $fn.IO ~~ :f }) {
say "file: $fn";
}
multi sub do-stuff(Str $fn where { $fn.IO ~~ :d }) {
say "dir: $fn";
}
multi sub do-stuff(Str $fn where { $fn.IO !~~ :e }) {
say "No such file: $fn";
}
sub MAIN(Str $filename) {
class Ratel {
has $.source;
has $.compiled;
has @.hunks;
method load(Str $filename) {
$.compile(slurp($filename));
}
method compile(Str $text) {
my $index = 0;
$!source = $text;
package Perlin;
use strict;
use Exporter 'import';
use Data::Dumper;
our @EXPORT_OK = qw/noise/;
our @P = (151,160,137,91,90,15,
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,
21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,
35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,
74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,
#include <stdio.h>
int rgb(int r, int g, int b) {
return 16 + r*36 + g*6 + b;
}
void main() {
for (int r = 0; r < 6; r++) {
for (int g = 0; g < 6; g++) {
for (int b = 0; b < 6; b++) {
for (int bgr = 0; bgr < 6; bgr++) {
NCURSES_EXPORT(WINDOW *)
initscr(void)
{
WINDOW *result;
NCURSES_CONST char *name;
START_TRACE();
T((T_CALLED("initscr()")));