Skip to content

Instantly share code, notes, and snippets.

View jberger's full-sized avatar

Joel Berger jberger

View GitHub Profile
use Mojolicious::Lite;
get '/' => sub {
my ( $c ) = @_;
$c->delay(
sub {
my ( $delay ) = @_;
say "Fetching Google";
$delay->pass('google');
@jberger
jberger / test.pl
Last active March 3, 2016 16:48 — forked from anonymous/test.pl
#!/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 @_;
});
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;
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);
}
#!/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
#
#!/usr/bin/env perl
use strict;
use warnings;
#############################
# Getting the Forecast Data #
#############################
use PDL;
use Time::Piece;
@jberger
jberger / fit-data.pl
Created February 2, 2012 21:55 — forked from run4flat/fit-data.pl
Simple Perl script to generate and fit noisy linear data
use strict;
use warnings;
use v5.10;
=pod
To run, say something like this:
perl fit-data.pl data.dat