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; | |
use experimental :macros; | |
role mmm { | |
method ACCEPTS(Code:D: |c) { | |
dd self;dd c; # debugging! | |
return False unless c ~~ self.signature; | |
self.(|c); | |
return True; | |
} |
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; | |
use NativeCall; | |
class winsize is repr('CStruct') { | |
has uint16 $.rows; | |
has uint16 $.cols; | |
has uint16 $.xpixels; | |
has uint16 $.ypixels; | |
method gist() { |
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 v5.26; | |
use strict; | |
use warnings; | |
package My::Thing { | |
use Moo; | |
has value => ( is => 'ro', required => 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
#!/bin/bash | |
set -e | |
function class() { | |
current_class="$1" | |
} | |
declare -A _inheritance | |
function extends() { | |
_inheritance[$current_class]="$*" |
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; | |
unit class Foo; | |
has $.thing; |
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
feeding a 18kb email message, I get: | |
$ perl6 /tmp/p.p6 medium-sized-email-message.txt | |
slurping 0.00634555 | |
matching 1.1612016 | |
parsing 0.02143336 |
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 5.024; | |
use strict; | |
use warnings; | |
use experimental 'signatures'; | |
use Astro::MoonPhase (); | |
use DateTime; | |
use DateTime::Event::Easter; | |
# IFC = International Fixed Calendar |
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 5.024; | |
use strict; | |
use warnings; | |
use experimental 'signatures'; | |
package Foo { | |
sub new($class,%attrs) { bless \%attrs,$class } | |
sub thing($self,$value=return $self->{thing}) { $self->{thing} = $value } | |
}; |
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
(require 'vagrant-tramp) | |
(defun dakkar-cache-vagrant (orig &rest args) | |
(let ((repo (pcache-repository "vagrant-tramp")) | |
(key 'all-boxes)) | |
(if (pcache-has repo key) | |
(pcache-get repo key) | |
(let ((value (apply orig args))) | |
(pcache-put repo key value 300) | |
value)))) |
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
(defun dakkar/perl-indent (beg end) | |
(interactive "r") | |
(if (use-region-p) | |
(cond ((get-text-property beg 'in-pod) | |
(let* ( | |
(text (buffer-substring beg end)) | |
(indented-text (with-temp-buffer | |
(insert text) | |
(cperl-mode) | |
(cperl-indent-region 0 (buffer-size)) |
NewerOlder