Skip to content

Instantly share code, notes, and snippets.

@masak
masak / fizzbuzz.p6
Last active September 10, 2017 03:02 — forked from walkermatt/fizzbuzz.clj
fizzbuzz without conditionals in Perl 6
# fizzbuzz without conditionals in Perl 6
# Simple pattern matching using multi subs
sub fizzbuzz($n) {
multi case($, $) { $n }
multi case(0, $) { "fizz" }
multi case($, 0) { "buzz" }
multi case(0, 0) { "fizzbuzz" }
case $n % 3, $n % 5;
use v6;
### CODE GOES HERE ###
my $matrix =
┌ ┐
│ 1, 2, 3 │
│ 4, 5, 6 │
└ ┘
@masak
masak / PROMISE.pl
Last active December 18, 2015 17:28 — forked from labster/PROMISE.pl
use strict;
use warnings;
use feature 'say';
package Promise {
sub state {
return shift->{'state'};
}
@masak
masak / gen.pl
Created February 15, 2012 15:00 — forked from moritz/gen.pl
Generate random, balanced bracket strings
sub gen(Int $c = 6) {
my @l = '[' xx $c;
my @r = ']' xx $c;
my $s = '';
$s ~= (@l == @r ?? @l
!! (@l + @r).rand < @l
?? @l
!! @r).shift
while @l || @r;

Hi,

We (jnthn + masak) met to discuss the next event, and came up with some ideas. We came up with one talk that we'd give jointly, 2 proposals for masak to give, and 3 proposals for jnthn to give. From here, it depends on how many slots we have; if we were to have 5 slots, then the joint one plus masak's two and the choice of 2 out of the 3 suggested for jnthn would work. If we are going to have a guy come along and do a couple of JavaScript ones, that'd take us up to 7 sessions, which is enough for an event. :-)

Anyway, here's the ideas.

Git for the Enterprise

Presented jointly by Carl Mäsak and Jonathan Worthington

@masak
masak / abstract.md
Created June 21, 2011 20:17 — forked from jnthn/abstract.md
Perl Course

TItle

"Intermediate Perl" or "Advanced Perl"

Abstract

Perl was created in 1987, and in growing up it has attracted system administrators, web developers, bioinformaticians, and application devlopers among its ranks. The language itself has also evolved; Perl today doesn't look like Perl in the nineties.

# http://www.elliottkember.com/kember_identity.html
use v6;
pir::load_bytecode('Digest/MD5.pir');
my Int $count = 0;
my Str @alphabet = (0..9, 'a'..'f');
my Str $string = @alphabet.roll(32).join;
loop {