This file contains hidden or 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 NativeCall; | |
sub lib { '/usr/lib/x86_64-linux-gnu/libglfw.so.3.1' } | |
=head1 GLFW/OpenGL in Perl 6 | |
=head2 Bindings | |
class Window is repr('CPointer') {} | |
class Monitor is repr('CPointer') {} |
This file contains hidden or 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
our $throw-on-mismatches; | |
has Bool $!throw-on-mismatches; | |
multi method throw-on-mismatches(Test::Lab::Experiment:U : Bool $flag?) { | |
with $flag { | |
Test::Lab::Experiment::<$throw-on-mismatches> = $flag | |
} else { | |
Test::Lab::Experiment::<$throw-on-mismatches> // False | |
} | |
} |
This file contains hidden or 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(); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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) { * } |