Skip to content

Instantly share code, notes, and snippets.

Joel Berger jberger

Block or report user

Report or block jberger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test.pl
#!/usr/bin/env perl
use strict;
use warnings;
use YAML::PP;
my $yaml = YAML::PP->new( schema => ['YAML1_1'] );
# or
#use YAML::PP::LibYAML;
View log_context.pl
use Mojolicious::Lite -signatures;
sub _generate_id { ... }
{
package Mojo::Log::WithContext;
use Mojo::Base 'Mojo::Log', -signatures;
has context => sub { {} };
has id => sub { _generate_id() };
has format => sub { sub ($id, $first, @lines) { ("[$id] $first", @lines) } };
View jeopardy.pl
use Mojo::Base -strict;
use Mojo::URL;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
my ($id) = @ARGV;
my $url = Mojo::URL->new('http://www.j-archive.com/showgame.php')->query(game_id => $id);
View distify
#!perl
use strict;
use warnings;
use Archive::Tar;
use CPAN::Meta;
use ExtUtils::Manifest qw/mkmanifest maniread/;
use Module::CPANfile;
use Module::Metadata;
@jberger
jberger / cli_app.pl
Last active Jun 1, 2019
A simple CLI app runner with commands in another namespace
View cli_app.pl
use strict;
use warnings;
use feature 'say';
package CLI;
use Moo;
use Carp ();
has commands => (
View gist:93c719cf9e50ff41fbcdbfc88fb5e399
<jberger> so as people are assembling for PTS (which I sadly am not able to attend this year) I want to float an idea that I've been thinking a lot about
and it specifically derives from building out the CI/CD system we're using at $work
I'd like there to be some way to delegate the module version to the META file
this is handy because I can build a darkpan dist and not need to modify the code in order to do so (if the version isn't in the code)
but it also gives us some other nice perks
no need to statically parse the version out of the code
and an opportunity to newer/better enforce standards on versions declared in this way
I'd see it as opt in in the module probably
use VersionFromMETA 'Distname'; or some such
we'd have to have tooling that would make the meta available obviously
View audio.log
17:24:25.044 - mycroft.configuration.config:load_local:109 - DEBUG - Configuration /opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/configuration/mycroft.conf loaded
17:24:25.300 - mycroft.configuration.config:load_local:109 - DEBUG - Configuration /opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/configuration/mycroft.conf loaded
17:24:25.542 - mycroft.configuration.config:load_local:109 - DEBUG - Configuration /etc/mycroft/mycroft.conf loaded
17:24:25.777 - mycroft.configuration.config:load_local:109 - DEBUG - Configuration /home/mycroft/.mycroft/mycroft.conf loaded
17:24:26.037 - mycroft.identity:_load:44 - DEBUG - Loading identity
17:24:26.052 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.mycroft.ai:443
17:24:26.438 - urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/device/059a2be3-6160-4300-844e-791345f0e74e HTTP/1.1" 200 476
17:24:26.683 - mycroft.configuration.config:load_local:109 - DEBUG - Configuration /opt/venvs/mycroft-core/lib/
View app.psgi
use Dancer2;
set template => 'simple';
set views => '.';
any '/text' => sub {
my $name = param('name') // 'world';
send_as plain => "hello $name";
};
@jberger
jberger / version.pl
Last active Nov 27, 2018
a VERSION method that checks for major version number as well as minimum version
View version.pl
use strict;
use warnings;
{
package MyPackage;
use version;
use Carp ();
our $VERSION = '2.01';
View ably.pl
# Developed using:
# https://www.ably.io/documentation/client-lib-development-guide
# https://docs.ably.io/client-lib-development-guide/
# This PoC code is released under the terms of the Artistic 2.0 license
# Copyright (c) 2018 by Joel Berger
use Mojo::Base -strict, -signatures;
use Mojo::Promise;
use Mojo::UserAgent;
You can’t perform that action at this time.