Skip to content

Instantly share code, notes, and snippets.

View Xliff's full-sized avatar
🏠
Working from home

Xliff Xliff

🏠
Working from home
View GitHub Profile
@Xliff
Xliff / CookieButStr.md
Created January 10, 2023 22:19
Cro Error: Expected CookieValue but got Str
Type check failed in assignment to $!value; expected CookieValue but got Str ("\"2|1:0|10:16721936...)
in submethod BUILD at /home/cbwood/Projects/cro-http/lib/Cro/HTTP/Cookie.pm6 (Cro::HTTP::Cookie) line 155
  in method unpack-cookie at /home/cbwood/Projects/cro-http/lib/Cro/HTTP/Request.pm6 (Cro::HTTP::Request) line 167
  in method cookie-value at /home/cbwood/Projects/cro-http/lib/Cro/HTTP/Request.pm6 (Cro::HTTP::Request) line 189
  in method add-csrf-protection at /home/cbwood/Projects/cro-webapp/lib/Cro/WebApp/Form.rakumod (Cro::WebApp::Form) line 657
  in method HTML-RENDER-DATA at /home/cbwood/Projects/cro-webapp/lib/Cro/WebApp/Form.rakumod (Cro::WebApp::Form) line 459
@Xliff
Xliff / Gtk4Editor.md
Created January 4, 2023 06:53
My Quick 'n' Dirty Editor in GTK4

I wrote up a quick and dirty editor as a test case for some my GTK4 work.

Heres a sample screenie:

image

And here's what the code looks like:

use v6.c;
@Xliff
Xliff / EasyCron.md
Created October 18, 2022 02:42
A Simple Cron

Here's something I wrote for guifa a couple of days ago. I am thinking of turning it into a simple Rakuish event loop for my projects.

Is this a fairly decent implementation, or is this just NIH for cron?

Please share your thoughts.

my %suppliers;
@Xliff
Xliff / ParameterAliases.md
Created October 12, 2022 05:32
On Named Parameter Aliases...

Have I told you how wonderful I think Raku is?

Well I don't have enough words to do that.

However even the best languages have thier faults, and one of Raku's the following:

sub a ( :name(:named(:$names)) ) { ... }
@Xliff
Xliff / CroControllerMethods.md
Last active August 25, 2022 11:19
Methods as Cro Controllers

So I was looking through what I have written for $dayJob, as far as my work with a Cro-based application server is concerned.

It occurred to me that we might be able to clean up what is already a fairly clean Cro dispatch handler.

Consider this example:

  route {
    get ->                { ... }
    get -> '2'            { ... }
@Xliff
Xliff / WhoseYoQuery.md
Last active August 17, 2022 01:31
How's this for SQL Code?

Wouldn't it be nice if you could write your queries like this?

  #| SELECT DISTINCT date_format(`last-updated`, '%i') minute
  #| FROM instances
  #| ORDER BY 1
  method getReportingMinutes (Str $instance-id) is query { }

Or this...

@Xliff
Xliff / gist:2f7216dae1dd502b218e2f3de25d0e70
Created June 5, 2022 21:26
CompUnit::DependencySpecification is not a mixin type
```
Stage start : 0.000
New type Stash for CompUnit::DependencySpecification is not a mixin type
at SETTING::src/core.c/Exception.pm6:64 (/home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/runtime/CORE.c.setting.moarvm:throw)
from SETTING::src/core.c/CompUnit/PrecompilationRepository.pm6:83 (/home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/runtime/CORE.c.setting.moarvm:)
from SETTING::src/core.c/CompUnit/PrecompilationRepository.pm6:81 (/home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/runtime/CORE.c.setting.moarvm:)
from SETTING::src/core.c/CompUnit/PrecompilationRepository.pm6:80 (/home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/runtime/CORE.c.setting.moarvm:)
from <unknown>:1 (/home/cbwood/Projects/p6-GtkPlus/scripts/.precomp/2A390A80BF2C91CDB606E4FDDAFDA286D92D8917/5C/5CF3C3DB510B0443D71ACBFE268138D0597256D7:<dependencies+deserialize>)
from SETTING::src/core.c/CompUnit/Loader.pm6:50 (/home/cbwood/.rakubrew/versions/moar-blead/instal
@Xliff
Xliff / ImmutableUponEval.md
Created May 19, 2022 20:29
Some weird RakuAST!

Here is some RakuAST. It behaves a bit differently than you'd expect:

use MONKEY-SEE-NO-EVAL;

my $ast = RakuAST::ApplyInfix.new(
      left => RakuAST::IntLiteral.new(44),
      infix => RakuAST::Infix.new('+'),
      right => RakuAST::IntLiteral.new(22)
);
@Xliff
Xliff / ListMP3s.md
Created April 23, 2022 21:25
A Quick MP3 listing script

Here is a quick block for if you want to list MP3s from the command line:

use Audio::TagLib; 

my @a = @*ARGS.map({ 
  my $t = Audio::TagLib.new($_); 
  [ $t.track, $t.title, $t.artist ] 
}); 
 
@Xliff
Xliff / v2022.03-87-g2182d530e.md
Created April 3, 2022 10:11
p6-GLib-Compile Times for week of March 27, 2022

p6-GLib Compile times for Raku version v2022.03-87-g2182d530e.

               Non-Parallel  Parallel      
ICal                 563.14     122.48526  
GLib                 397.27      83.71528  
GIR                  111.60      24.41031  
ATK                  154.18      28.75674  
GIO                  849.62     181.00926  
Secret                92.29      12.52312