This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojo::Base -strict, -signatures; | |
use Mojo::File; | |
use Term::ANSIColor; | |
my $guard_file = Mojo::File->new('/tmp/bluetooth.status.guard'); | |
(sub($name) { | |
({ | |
wakeup => \&awake, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojolicious::Lite -signatures; | |
get '/' => sub($c) { | |
$c->render( text => $c->req->url->to_abs->port ) | |
}; | |
# Does not work | |
hook before_server_start => sub($server, $app) { | |
app->log->debug('before_server_start'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use FindBin qw($Bin); | |
use lib "$Bin/local/lib/perl5"; | |
use Mojo::Base -strict, -signatures; | |
use Mojo::File qw( path ); | |
use Parse::EDID qw/ parse_edid /; | |
use Mojo::JSON qw/ to_json /; | |
my $cards = cards_info(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojo::Base -strict, -signatures; | |
use Data::Dump qw/pp/; | |
say pp diffhash( { map { $_ => 1 } 1..30 }, { map { $_ => 1 } 20..60 } ); | |
sub diffhash($h1, $h2) { | |
my ($h1p, $h2p) = ({%$h1}, {%$h2}); | |
for (keys %$h1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojo::Base -strict; | |
use Mojo::IOLoop; | |
my $promise = Mojo::IOLoop->delay; | |
Mojo::IOLoop->timer(2 => sub{ $promise->resolve(2) }); | |
$promise->then(sub{ | |
my $waited = shift; | |
my ($t1, $t3) = map { Mojo::IOLoop->delay } 1..2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" gist-vim | |
let g:gist_open_browser_after_post = 1 | |
let g:gist_clip_command = 'xclip -selection clipboard' | |
map <silent> ,g :Gist<CR> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use common::sense; | |
use Mojo::UserAgent; | |
use Email::Address; | |
my $url = shift || say("Usage: $0 URL") && exit; | |
my $dom = Mojo::UserAgent->new->get($url)->res->dom; | |
say $_->address for Email::Address->parse( $dom->content ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojo::DOM | |
use v5.24; | |
# Example of Mojo::DOM (7.33) mungling whitespaces | |
my $dom = Mojo::DOM->new('<div><h1>This is<span> Just Some Test</span></h1></div>'); | |
say $dom->content; # <div><h1>This is<span>Just SomeTest</span></h1></div> | |
say $dom->at('h1')->all_text # This isJust SomeTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script_line1 = use strict | |
script_line2 = use warnings | |
script_line3 = use feature ':5.10'; | |
script_line4 = use lib './lib' | |
script_line5 = use utf8 | |
[Interrupt] | |
[DataDump] | |
[Colors] | |
[ReadLine] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Resque::WorkingClass; | |
use Moose (); | |
use Moose::Exporter; | |
Moose::Exporter->setup_import_methods( | |
with_meta => [ 'perform' ], | |
also => 'Moose', | |
); | |
sub perform { |
NewerOlder