Skip to content

Instantly share code, notes, and snippets.

@nicomen
nicomen / db_proxy.pm
Last active December 6, 2017 13:31
Simple db proxy class
package Supplier;
use strict;
use warnings;
use Moo;
use Carp qw/croak/;
has 'code' => ( is => 'ro', required => 1 );
has 'db_row' => ( is => 'lazy', builder => 1 );
@nicomen
nicomen / gist:8c01cc4e2c72af6c90cc580048c50d04
Created October 30, 2017 19:46
max 4 parallell jobs while testing syntax
#!/usr/bin/perl
use strict;
use warnings;
use Test::More;
use Test::Strict;
use Test2::AsyncSubtest;
use POSIX ":sys_wait_h";
@nicomen
nicomen / gist:1bceaaf0a7d12d9bb0f432cb2a9e88c9
Created September 21, 2017 11:49
moo-outdated on Mac OS X
arne@aBook ~/S/r/legacy-cronjobs> moo-outdated
dyld: lazy symbol binding failed: Symbol not found: _Perl_xs_handshake
Referenced from: /Users/arne/perl5/lib/perl5/darwin-thread-multi-2level/auto/Sub/Name/Name.bundle
Expected in: flat namespace
dyld: Symbol not found: _Perl_xs_handshake
Referenced from: /Users/arne/perl5/lib/perl5/darwin-thread-multi-2level/auto/Sub/Name/Name.bundle
Expected in: flat namespace
| fish: 'moo-outdated' terminated by signal SIGABRT (Abort)
Role::Tiny
/Users/arne/perl5/lib/perl5/Role/Tiny.pm: 2.000005
Moo
/Users/arne/perl5/lib/perl5/Moo.pm: 2.003002
Moo::_mro
/Users/arne/perl5/lib/perl5/Moo/_mro.pm: ?
@nicomen
nicomen / sql_abs.pl
Created March 21, 2017 20:01
get valid sqlite table and column names for sqlite3
✔ 21:00 ~ $ cat sql_abs.pl
#!/usr/bin/perl
use feature 'say';
use SQL::Abstract;
my $abs = SQL::Abstract->new();
say join ',', $abs->select('my_table', [ 'my_table.my_id' ], { my_id => '1' });
my $abs = SQL::Abstract->new( quote_char => '`' );
@nicomen
nicomen / .diff
Created January 30, 2017 19:58 — forked from anonymous/-
diff --git a/lib/Test/Mojo.pm b/lib/Test/Mojo.pm
index b12e0bc..cf736ef 100644
--- a/lib/Test/Mojo.pm
+++ b/lib/Test/Mojo.pm
@@ -17,7 +17,8 @@ use Mojo::Util qw(decode encode);
use Test::More ();
has [qw(message success tx)];
-has ua => sub { Mojo::UserAgent->new->ioloop(Mojo::IOLoop->singleton) };
+has ua => sub { Mojo::UserAgent->new->ioloop(Mojo::IOLoop->singleton) };
@nicomen
nicomen / gist:fe4732cf7033442e04139ceb632749ef
Last active December 21, 2016 21:45
Slightly different error output string eval vs parse file vs latin1 input
$ perl -wle 'my $é = 5'
Can't use global $� in "my" at -e line 1, near "my $�"
Unrecognized character \xA9; marked by <-- HERE after my $�<-- HERE near column 6 at -e line 1.
$ perl -wle 'eval q/my $é = 5/ or die $@'
Unrecognized character \xA9; marked by <-- HERE after my $�<-- HERE near column 6 at (eval 1) line 1.
$ perl -wle 'eval qq/my \$\xC3 = 5/ or die $@'
Can't use global $� in "my" at (eval 1) line 1, near "my $� "
...
PerlModule SmartGiant
PerlOptions +SetupEnv
RewriteEngine on
ProxyPreserveHost On
RewriteCond %{HTTP_HOST} !^m.solfaktor
RewriteRule ^/(step1|step1_meta|asset/|services/|layouts/)(.*)$ http://%{HTTP_HOST}.prod.reisegiganten.net/$1$2 [P,L]
@nicomen
nicomen / perl.pl
Last active December 7, 2016 18:38
package RG::Charter::Tree;
# FIXME: Remove me when frontend does not use this in production anymore
use Moo;
use 5.010;
use Clone 'clone';
use Data::Rmap;
$ git clone -b dev git@github.com:reisegiganten/libraries.git --depth=1 libraries-dev
Cloning into 'libraries-dev'...
warning: templates not found /home/nicolasm/.gittemplate
remote: Counting objects: 525, done.
remote: Compressing objects: 100% (485/485), done.
remote: Total 525 (delta 52), reused 196 (delta 17), pack-reused 0
Receiving objects: 100% (525/525), 10.66 MiB | 1.97 MiB/s, done.
Resolving deltas: 100% (52/52), done.
Checking connectivity... done.
✔ 19:21 /projects/Reisegiganten $ cd libraries-dev/