Skip to content

Instantly share code, notes, and snippets.

View szabgab's full-sized avatar

Gábor Szabó szabgab

View GitHub Profile
@szabgab
szabgab / walk.rs
Last active September 4, 2023 17:55
use std::path::Path;
use std::fs::ReadDir;
//#[derive(Debug)]
//#[allow(dead_code)]
struct Walk {
rds: Vec<ReadDir>,
}
use strict;
use warnings;
use feature 'say';
use Time::HiRes qw(sleep time stat);
{
open(my $fh, '>', 'first.txt');
close $fh;
}
# this is planned to be a bit more generic than needed here
my $root = $*PROGRAM.absolute.IO.dirname;
if $root.IO.basename eq 'bin' {
$root = $root.IO.dirname;
}
my $files = Bailador::Route::StaticFile.new: directory => $root, path => /.*/;
get '/(.*)' => sub ($url) {
#return $root;
my $file = ($url eq '' ?? 'index' !! $url) ~ '.html';
names = ["Foo", "Borg", "Earth"]
print(sorted(names))
print(sorted(names,key=len))
print(sorted(names, key=lambda x: x[1] ))
a = [
["Joe", 23],
["Mary", 78],
["Steffan", 100],
]
air:Perl6-Maven gabor$ ack ~~
app.pl
70: if $file ~~ /\/$/ {
95: if $file ~~ /tutorial\/(.*)/ {
lib/Perl6/Maven/Page.pm6
29: if $line ~~ m/^\=(\w+) \s+ (.*)/ {
84: if $row ~~ /^\<code (\s+ lang\=\".*\")? \>\s*$/ {
87: } elsif $row ~~ /\<\/code\>/ {
91: $row ~~ s:g/\</&lt;/;
@szabgab
szabgab / gist:7a08dd2d108177618ac0
Created October 22, 2014 15:04
MetaCPAN API error
use strict;
use warnings;
use Data::Dumper qw(Dumper);
use HTTP::Tiny;
use JSON qw(to_json);
my $ua = HTTP::Tiny->new();
my $query_json = to_json {
query => {
match_all => {},
@szabgab
szabgab / gist:58f8fb6e345a567de506
Last active August 29, 2015 14:07
MetaCPAN API error
use strict;
use warnings;
use Data::Dumper qw(Dumper);
use HTTP::Tiny;
use JSON qw(to_json);
my $ua = HTTP::Tiny->new();
my $query_json = to_json {
query => {
match_all => {},
Can't stat modules/file-find/lib: No such file or directory
at tools/build/module-install.pl line 22.
Can't stat modules/shell-command/lib: No such file or directory
at tools/build/module-install.pl line 22.
Can't stat modules/perl6-psgi/lib: No such file or directory
at tools/build/module-install.pl line 22.
===SORRY!===
Could not find Shell::Command in any of: /Users/gabor/work/rakudo-star-2013.10/install/lib/parrot/5.9.0/languages/perl6/lib, /Users/gabor/work/rakudo-star-2013.10/install/lib/parrot/5.9.0/languages/perl6/site/lib, /Users/gabor/work/rakudo-star-2013.10/install/lib/parrot/5.9.0/languages/perl6/vendor/lib, /Users/gabor/work/rakudo-star-2013.10/install/lib/parrot/5.9.0/languages/perl6/lib, /Users/gabor/.perl6/2013.10/lib
===SORRY!===
@szabgab
szabgab / 002_index_route.t
Last active December 26, 2015 23:59
Dancer Cookie issue
use Test::More tests => 6;
use strict;
use warnings;
# the order is important
use Temp;
use Dancer2::Test apps => ['Temp'];
use YAML qw(LoadFile);
route_exists [GET => '/'], 'a route handler is defined for /';
@szabgab
szabgab / gist:6342224
Created August 26, 2013 14:47
GitPrep, the open source GitHub clone
GitPrep, the open source GitHub clone
When you want to run a GitHub-like system in-house, GitPrep written by Yuki Kimoto
can a good choice.
It is Open Source, [its source code](https://github.com/yuki-kimoto/gitprep) is on GitHub
and it is licensed under the Artistic license.
The [project home page](http://perlcodesample.sakura.ne.jp/gitprep-site/) includes a
screenshot, but you can also visit a project hosted on a