Skip to content

Instantly share code, notes, and snippets.

View pangyre's full-sized avatar

Ashley Pond V pangyre

View GitHub Profile
@pangyre
pangyre / gist:fe0688a40993a0deee9a84f99c98a04d
Last active June 16, 2019 18:51 — forked from pjlsergeant/gist:2556399
Concise map-reduce in Perl
#!/usr/bin/env perl
use strictures;
use List::Util "reduce";
use Path::Tiny;
use YAML;
# Given a list of filenames, return a hash of each word and the number
# of times it occurs.
my $reduced = word_count(@ARGV);
@pangyre
pangyre / http-status-diff.pl
Last active June 5, 2018 01:54
Tool to compare Wikipedia's current understanding of HTTP status codes in Perl's HTTP::Status
#!/usr/bin/env perl
use strictures;
use XML::LibXML;
use HTTP::Status "status_message";
print "Checking HTTP::Status version ",
HTTP::Status->VERSION, $/, $/;
my $page = do { local $/; <DATA> };
my $dom = XML::LibXML->load_html( string => $page );
BEGIN {
package Promise;
use Moo;
my %STATES = map { $_ => 1 } qw/ PENDING FULFILLED REJECTED /;
has "value" => is => "ro", writer => "_value";
has "reason" => is => "ro", writer => "_reason";
has [qw/ on_fulfill on_reject /] =>
is => "ro",
@pangyre
pangyre / xlit.psgi
Created June 27, 2012 15:49
For messing around with Unidecode and Soundex easily.
#!/usr/bin/env perl
use strict;
use Encode;
use Text::Unidecode;
use Plack::Request;
use Text::Soundex;
use HTML::Entities;
=head1 Synopsis
sub render : ActionClass('RenderView') {}
sub end : Private {
my ( $self, $c ) = @_;
$c->forward("render");
}
sub render : ActionClass('RenderView') {}
sub end : Private {
my ( $self, $c ) = @_;
$c->forward("render");
}
@pangyre
pangyre / ghcn-v2-raw-global-mean-temp-google-chart-generator.pl
Created February 27, 2010 21:49
GHCN v2 Raw Global Mean Temperatures Google Chart Generator
#!/usr/bin/env perl
use warnings;
use strict;
use List::Util qw( first );
use Statistics::Descriptive;
use HTML::Entities;
use Time::Progress;
use URI::GoogleChart;
use LWP::Simple qw( mirror );
use File::HomeDir;