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
unit module Bob; | |
class Bob is export { | |
method hey ($input) { | |
given $input { | |
when $_.ends-with('?') { say 'Sure.' } | |
when $_.ends-with('!') { say 'Whoa, chill out' } | |
when $_ eq '' { say 'Fine. Be that way!' } | |
default { say 'Whatever.' } | |
} |
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
given @*ARGS[0] { | |
when @_ eq '-p' or @_ eq '--phrase' { | |
say translate(@*ARGS[1]); | |
} | |
when @_ eq '-f' or @_ eq '--file' { | |
say translate(@*ARGS[1].IO.slurp); | |
} | |
default { | |
say 'You must provide either "-p"/"--phrase" and a phrase or "-f"/"--file" and a filepath.'; | |
exit(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
use NativeCall; | |
sub libfluidsynth { '/usr/lib/x86_64-linux-gnu/libfluidsynth.so.1.5.2' } | |
class FluidSettings is repr('CPointer') { | |
sub new_fluid_settings() returns FluidSettings is native(&libfluidsynth) { * } | |
sub delete_fluid_settings(FluidSettings) is native(&libfluidsynth) { * } | |
sub fluid_settings_setstr(FluidSettings, Str, Str) is native(&libfluidsynth) { * } | |
sub fluid_settings_setnum(FluidSettings, Str, num64) is native(&libfluidsynth) { * } |
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
class Human { | |
has $.name; | |
has $!age; | |
method age { | |
($!age * 0.8).round; | |
} | |
method new (:$name, :$age) { self.bless(:$name, :$age); } | |
} |
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
import gi | |
gi.require_version('Nautilus', '3.0') | |
from gi.repository import Nautilus, GObject | |
from subprocess import call | |
class AtomExtension(GObject.GObject, Nautilus.MenuProvider): | |
def __init__(self): | |
pass |
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
# jrusso at nomad in ~/github/p6-xtest on git:master x [17:02:10] | |
$ perl6-debug-m --ll-exception -Ilib -e 'use X11::XTest; XTest.new.key-event("Control-Shift-t", :down)' | |
Circular module loading detected involving module 'Debugger::UI::CommandLine' | |
at gen/moar/m-CORE.setting:34736 (/home/jrusso/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm::49) | |
from gen/moar/m-CORE.setting:3459 (/home/jrusso/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:sink-all:167) | |
from gen/moar/m-CORE.setting:11958 (/home/jrusso/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:sink:36) | |
from gen/moar/m-CORE.setting:34734 (/home/jrusso/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm::115) | |
from gen/moar/m-CORE.setting:34729 (/home/jrusso/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm::52) | |
from gen/moar/m-CORE.setting:30333 (/home/jrusso/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:protect:51) | |
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
$ perl6 | |
Welcome to the Perl 6 REPL - $VERSION | |
{$linenoise ?? '' !! 'For history and tab completion: panda install Linenoise'} | |
> |
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
sub non-zero(%env) { | |
#| for debugging, removes wires with a value of zero | |
my %res; | |
for %env.kv -> $wire, $value { | |
if $value != 0 { %res.push: $wire => $value }; | |
} | |
%res; | |
} | |
sub sortfile($filename) { | |
#| places assignments at the beginning of a sorted input file |
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
MIDI = require 'midi' | |
{CompositeDisposable} = require 'atom' | |
module.exports = ActivateAuxiliaryControls = | |
subscriptions: null | |
activate: (state) -> | |
@subscriptions = new CompositeDisposable |
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 B; | |
sub bar { "world"; } | |
say foo() ~ bar(); |