Skip to content

Instantly share code, notes, and snippets.

Avatar

Joel Berger jberger

View GitHub Profile
View zach.pl
use Mojo::Base -strict;
use Mojo::DOM;
my $html = q!<img src='/__swift/themes/admin_default/images/mimeico_blank.gif' valign='middle' style='position: relative; top: -1px;'> <a href='https://paster.reflected.net/get/665cb7a9-0735-47c9-a33e-3cad17d0b730'><strong>prometheus.20200605.yml</strong></a>!;
my $dom = Mojo::DOM->new($html);
my $anchor = $dom->at('a');
my $href = $anchor->{href};
@jberger
jberger / tpf_cat_statement.txt
Last active Sep 3, 2021
Proposed statement pausing the TPF CAT
View tpf_cat_statement.txt
When embarking on community moderation and when claiming the authority to mete out judgements, clear policy and procedure is
key to keep the moral authority to do so and to protect all of the parties involved.
Effective immediately, The Perl Foundation (TPF)'s Community Affairs Team (CAT) will not accept any incoming reports nor issue
any rulings until such time as:
a) a set of policies can be created to govern it
b) that policy is voted on and accepted by the TPF governing board
c) the policy, reporting procedure, and CAT board membership are clearly posted on the TPF's main website
Once this is done we hope to rebuild a sense of trust within the Perl Community and to act to keep it safe and welcoming.
View andy.pl
use Mojo::Base -strict, -signatures;
use Mojo::UserAgent;
use Mojolicious;
my $mock = Mojolicious->new;
$mock->routes->any('/' => sub ($c) { $c->render(data => $c->req->body) });
my @content = (qw(this is a test));
View andy.pl
use Mojo::Base -strict, -signatures;
use Mojo::UserAgent;
my @content = (qw(this is a test));
my $iterator = sub { shift @content };
# Build a normal transaction
my $ua = Mojo::UserAgent->new;
my $tx = $ua->build_tx(GET => 'http://example.com');
@jberger
jberger / graphite
Last active Mar 31, 2021
A little graphite CLI tool
View graphite
#!/usr/bin/env perl
use Mojo::Base -strict;
use Getopt::Long qw(:config gnu_getopt no_auto_abbrev no_ignore_case);
use Mojo::Date;
use Mojo::URL;
use Mojo::UserAgent;
use Mojo::Util 'tablify';
View base.js
const Koa = require('koa');
const Router = require('@koa/router');
class Controller {
constructor(app, ctx) {
this.app = app;
this.ctx = ctx;
}
get req () { return this.ctx.request }
View app.conf
{
foo => 1,
plugins => [
{'HypnotoadRestarter' => {}},
]
}
View noname
cpanm (App::cpanminus) 1.7044 on perl 5.032000 built for darwin-2level
Work directory is /Users/joel/.cpanm/work/1613232918.271
You have make /usr/bin/make
You have /usr/local/bin/wget
You have /usr/bin/tar: bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.6
You have /usr/bin/unzip
Entering /Users/joel/Programs/Sites/mojolicious.io
Checking if you have Syntax::Highlight::Engine::Kate 0 ... Yes (0.14)
Checking if you have Statocles 0.093 ... No
Searching Statocles (0.093) on cpanmetadb ...
View perldeps.pl
#!/usr/bin/env perl
use strict;
use warnings;
use App::cpm::CLI;
use File::Spec;
use Carton::CPANfile;
use Carton::Snapshot;
View test.sql
select '1..1';
select 'ok 1' where 1=1;
-- run with: prove -e 'psql -At -f' test.sql