Skip to content

Instantly share code, notes, and snippets.

View jberger's full-sized avatar

Joel Berger jberger

View GitHub Profile
@jberger
jberger / ably.pl
Last active November 5, 2018 14:07
# 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;
use Mojo::Base -strict;
use Test::More;
use Carp ();
use Mojo::Promise;
sub await;
sub async {
my $body = shift;
use Mojolicious::Lite -signatures;
use Mojo::JSON 'to_json';
use Scalar::Util 'weaken';
{
package Mojo::Log::WithContext;
use Mojo::Base 'Mojo::Log';
has context => sub { {} };
}
use Mojo::Base -strict;
use Mojo::Util 'dumper';
use Mojo::Promise;
use Mojo::EventEmitter;
use Mojo::IOLoop;
sub promise_from_event {
my ($emitter, $success, $error) = @_;
my $p = Mojo::Promise->new;
@jberger
jberger / dist.pl
Last active October 10, 2018 19:50
use strict;
use warnings;
use Archive::Tar;
use CPAN::Meta;
use ExtUtils::Manifest qw/mkmanifest maniread/;
use Module::CPANfile;
use Module::Metadata;
use Module::Build::Tiny ();
use Time::Piece;
export function Fetcher (options) {
if (options.base) this.base = options.base;
};
Fetcher.prototype.fetch = function(input, init) {
if (input instanceof Request) {
return window.fetch(input, init);
}
let url = this.base ? new URL(input, this.base) : new URL(input);
use Mojo::Base -base;
use Mojo::Util 'dumper';
sub foo {
BEGIN { $^H{'in_foo'} = 1 };
bar();
}
sub bar {
my ($sub, $hints) = (caller(1))[3,10];

Keybase proof

I hereby claim:

  • I am jberger on github.
  • I am joelberger (https://keybase.io/joelberger) on keybase.
  • I have a public key whose fingerprint is 9575 69D3 A43A 3D70 2DF6 3DE3 5F89 85E7 57AD 7AAF

To claim this, I am signing this object:

@jberger
jberger / noname
Last active August 15, 2018 20:53
depth=0 C = US, ST = Virginia, L = Reston, O = MAGnet, CN = ssl.irc.perl.org
verify error:num=18:self signed certificate
verify return:1
depth=0 C = US, ST = Virginia, L = Reston, O = MAGnet, CN = ssl.irc.perl.org
verify return:1
CONNECTED(00000006)
---
Certificate chain
0 s:/C=US/ST=Virginia/L=Reston/O=MAGnet/CN=ssl.irc.perl.org
i:/C=US/ST=Virginia/L=Reston/O=MAGnet/CN=ssl.irc.perl.org
diff --git a/lib/Mojo/DOM.pm b/lib/Mojo/DOM.pm
index 8083d67f4..846d66898 100644
--- a/lib/Mojo/DOM.pm
+++ b/lib/Mojo/DOM.pm
@@ -78,12 +78,12 @@ sub following_nodes { $_[0]->_collect(_siblings($_[0]->tree, 0, 1)) }
sub matches { shift->_css->matches(@_) }
sub namespace {
- my $self = shift;
+ my ($self, $ns) = @_;