This file contains hidden or 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; | |
get '/' => sub { | |
my ( $c ) = @_; | |
$c->delay( | |
sub { | |
my ( $delay ) = @_; | |
say "Fetching Google"; | |
$delay->pass('google'); |
This file contains hidden or 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/perl | |
use Mojo::Base -strict; | |
use Mojo::UserAgent; | |
use Mojo::IOLoop; | |
my $ua = Mojo::UserAgent->new(max_redirects => 10); | |
my $delay = Mojo::IOLoop->delay(sub { | |
my $delay = shift; | |
say $_->req->url . " -> " . $_->res->code for @_; | |
}); |
This file contains hidden or 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 -base; | |
use 5.20.0; | |
use Mojo::UserAgent; | |
my $ua = Mojo::UserAgent->new; | |
$ua->websocket("ws://localhost:3000/code.json" => sub { | |
my ($ua, $tx) = @_; | |
return unless $tx->is_websocket; |
This file contains hidden or 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 Devel::Cycle; | |
use Mojo::UserAgent; | |
my $ua = Mojo::UserAgent->new; | |
sub fetch_it { | |
my ($url, $cb) = @_; | |
$ua->get($url => $cb); | |
} |
This file contains hidden or 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/local/bin/perl | |
# | |
# cpan-github-dists | |
# | |
# Use the MetaCPAN API to build a list of CPAN distributions that have a github repo | |
# We show the 2000 most-recently released distributions | |
# | |
# See output for this at http://neilb.org/github-dists.html | |
# |
This file contains hidden or 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 strict; | |
use warnings; | |
############################# | |
# Getting the Forecast Data # | |
############################# | |
use PDL; | |
use Time::Piece; |
This file contains hidden or 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 strict; | |
use warnings; | |
use v5.10; | |
=pod | |
To run, say something like this: | |
perl fit-data.pl data.dat |