Skip to content

Instantly share code, notes, and snippets.

View leejo's full-sized avatar
🏂

Lee J leejo

🏂
View GitHub Profile
@leejo
leejo / gist:d87b191ac2301ca18e5c473628d46181
Last active January 3, 2021 08:36
possible spam still in rt.cpan.org
Public/Bug/Display/100179/index.html:508:<span class="downloadcontenttype">application/x-gzip 628b</span>
Public/Bug/Display/100190/index.html:579:<span class="downloadcontenttype">application/gzip 41.7k</span>
Public/Bug/Display/100261/index.html:508:<span class="downloadcontenttype">application/x-gzip 628b</span>
Public/Bug/Display/100883/index.html:654:<span class="downloadcontenttype">application/x-gzip 72.7k</span>
Public/Bug/Display/100936/index.html:402:<span class="downloadcontenttype">application/zip 64.9k</span>
Public/Bug/Display/101007/index.html:651:<span class="downloadcontenttype">application/x-gzip 3.9k</span>
Public/Bug/Display/101007/index.html:712:<span class="downloadcontenttype">application/x-gzip 418b</span>
Public/Bug/Display/101007/index.html:808:<span class="downloadcontenttype">application/x-gzip 634b</span>
Public/Bug/Display/101092/index.html:487:<span class="downloadcontenttype">application/zip 127b</span>
Public/Bug/Display/101205/index.html:609:<span class="downloadcontenttype">
@leejo
leejo / gist:78f0308f7b757149afbda218def34a0b
Created September 11, 2018 14:57
string interpolation with double colon change
payprop@ubuntu-xenial:/tmp$ /opt/tools/bin/perl5.24.0 -w -E'my $foo = "works"; my $bar ="really"; say "$foo::$bar";'
works::really
payprop@ubuntu-xenial:/tmp$ /opt/tools/bin/perl5.28.0 -w -E'my $foo = "works"; my $bar ="really"; say "$foo::$bar";'
Use of uninitialized value $foo:: in concatenation (.) or string at -e line 1.
really
@leejo
leejo / gist:3d89925ee262587939804677a5ff4f7f
Created March 15, 2017 15:13
is this how windows versioning works?
> perl6
You may want to `panda install Readline` or `panda install Linenoise` or use rlwrap for a line editor
To exit type 'exit' or '^D'
> my @windows = 3, 95, 'xp', 'vista', 7 ... *;
[...]
> say $_ for @windows[0..20];
3
95
xp
@leejo
leejo / vim_commit_diff
Created August 24, 2016 20:43
split commit diff in commit message
if match( bufname(1),'COMMIT_EDITMSG' ) != -1
:silent !git diff --cached >/tmp/commit.diff
:silent :vsplit /tmp/commit.diff
:wincmd l
:wincmd H
:set spell
:set ft=gitcommit
endif
@leejo
leejo / reprove.pl
Created June 22, 2016 13:38 — forked from afresh1/reprove.pl
This script watches your tests and your files and re-runs "prove" to help with perl TDD -- http://perldoc.perl.org/prove.html
#!/usr/bin/perl
# Copyright (c) 2015 Andrew Fresh <andrew@afresh1.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@leejo
leejo / route_query
Created February 2, 2016 08:51
Route ordering with default stash values
This is the minimal test case i could reduce to showing the "issue"
it seems the route ordering doesn't matter in all cases until we start
adding default stash values in the `->to` block. i don't know if this
is known behaviour, but it caught us out recently and something to be
aware of:
```perl
#!/usr/bin/env perl
@leejo
leejo / route_issue
Last active February 1, 2016 13:52
Route ordering change
We have two routes, defined in this order:
```
$r->route('/cause/:cause_id/campaigns/:type/:paginate/:page/',
type=>[qw(active archived)],
paginate => [qw(page)],
cause_id => qr/\d+/,
page => qr/\d+/)
->to(
paginate => [qw(page)])->to(
@leejo
leejo / example.pl
Last active November 5, 2015 10:29
routes using a root
#!/usr/bin/env perl
# in reality this would be in a separate file
package ExampleApp;
# automatically enables "strict", "warnings", "utf8" and perl 5.10 features
use Mojo::Base qw( Mojolicious );
sub startup {
my ( $self ) = @_;
@leejo
leejo / mojo_swagger_authorization.markdown
Last active August 29, 2015 14:27
Mojo + Swagger2 + Authorization

In swagger.yaml - note use of x-mojo-privilege key under the route method, leave this blank for routes that don't require a privilege to access:

paths:
    /foo:
        get:
            x-mojo-controller: "MyApp::API::Foo"
            x-mojo-around-action: "MyApp::API::check_api_priv"
            x-mojo-privilege: "get:foo"
            operationId: get
@leejo
leejo / moo_coerce
Last active August 29, 2015 14:24
Trying to convert a MySQL date / timestamp to a DateTime object with Moo + Type::Tiny. Failing. Badly. Any clues?
#!perl
use strict;
use warnings;
package Type::Tester;
use Moo;
use Type::Library -base, -declare => qw/DateTime/;