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
use v6; | |
use experimental :macros; | |
macro splat-supply($b) { quasi { with {{{$b}}} { .tap:{ emit $_ }; .wait } } } | |
sub x { supply { emit 2; emit 3 } } | |
sub y { supply { emit 1; splat-supply x(); emit 4 } } | |
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
#!/bin/bash | |
# git find-ref $committish | |
# | |
# figure out which remote a committish comes from, and open its | |
# corresponding web view in a browser | |
# | |
# NOTE: doesn't work with tag names, I'm not sure if it's possible to | |
# know where a tag comes from |
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
CFLAGS=-std=c99 | |
use-it: use-it.o symbol.o | |
symbol.o: symbol.c symbol.h | |
use-it.o: use-it.c symbol.h |
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
use v6.d.PREVIEW; | |
# copied from https://github.com/FROGGS/p6-Ser/blob/master/lib/Ser.pm | |
sub serialize($obj is copy) { | |
use MONKEY-GUTS; | |
my Mu $sh := nqp::list_s(); | |
my $name = 'Ser_' ~ nqp::time_n(); | |
my Mu $sc := nqp::createsc(nqp::unbox_s($name)); |
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 5.020; | |
use experimental 'signatures'; | |
my @span=(-1,-1); | |
our $start=-1; | |
# this regex matches a series of -, some non-dashes that do not match | |
# 'some.{0,3}thing', and more dashes |
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; | |
use File::Spec; | |
my $libdir; | |
BEGIN { | |
my ($vol,$dirs,$file) = File::Spec->splitpath(__FILE__); | |
my @dirs = File::Spec->splitdir($dirs); | |
my $lib_dirs = File::Spec->catdir(@dirs,'lib'); | |
$libdir = File::Spec->catpath($vol,$lib_dirs,''); |
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
my @fizzes = (['','','Fizz'] xx *).flat; | |
my @buzzes = (['','','','','Buzz'] xx *).flat; | |
my @words = (@fizzes Z~ @buzzes); | |
my @numbers = 1 .. *; | |
my @fizzbuzz = (@numbers Z @words).map( *.max ); | |
.say for @fizzbuzz[^20]; |
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 5.020; | |
use threads; | |
sub run_child { | |
my ($value) = @_; | |
my $tid = threads->tid; |
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
use v6.d.PREVIEW; | |
use Cro::HTTP::Router; | |
use Cro::HTTP::Middleware; | |
use Cro::HTTP::Response; | |
use Cro::HTTP::Server; | |
use Cro::Transform; | |
# mixin for requests, carrying authentication info | |
role AuthToy::Request::Authed { | |
has Str $.user; |
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 HelperThing; | |
use strict; | |
use warnings; | |
use Moose::Exporter; | |
use 5.024; | |
use experimental 'signatures'; | |
use MethodMetaRole; | |
sub my_method($meta,$name,@args) { | |
my $body = pop @args; |