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
- # Just assume HTTP::Headers is a blessed hash ref | |
- +{%$headers}; | |
+ +{ map {$_ => $headers->header($_) } $headers->header_field_names }; |
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
sub scan_dir { | |
my ($path, $filter, $cb) = @_; | |
my (@queue, @matches); | |
my $cv = AE::cv; | |
my $enqueue = sub { | |
$cv->begin; | |
push @queue, shift; | |
}; |
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
diff --git a/lib/Alice/Role/IRCEvents.pm b/lib/Alice/Role/IRCEvents.pm | |
index 2c6e676..9dd0bf9 100644 | |
--- a/lib/Alice/Role/IRCEvents.pm | |
+++ b/lib/Alice/Role/IRCEvents.pm | |
@@ -10,6 +10,13 @@ use Class::Throwable qw/InvalidNetwork DisconnectError ConnectError/; | |
our %EVENTS; | |
+# array of all our IPs | |
+our @IPS; |
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 AnyEvent; | |
use AnyEvent::Redis; | |
use Plack::Request; | |
use v5.12; | |
my $redis = AnyEvent::Redis->new; | |
sub { |
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
class Plugin { | |
meta { | |
has @commands; | |
method command { | |
my ($command, $callback) = @_; | |
push @commands, [$command, $callback]; | |
} | |
} | |
} |
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 v5.10; | |
use Test::TCP; | |
use AnyEvent::Handle; | |
say "hit Ctrl-C to cancel"; | |
my $cv = AE::cv; | |
my $s = AE::signal INT => sub { unlink "/tmp/$_" for qw/redis.conf dump.rdb/; $cv->send }; |
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 DBI; | |
my $dbh = DBI->connect("DBI:mysql:database=x", "x", "x"); | |
my $pattern = "%media.arstechnica.com%"; | |
my $sth = $dbh->prepare("SELECT entry_text, entry_text_more FROM mt_entry WHERE entry_text LIKE ? OR entry_text_more LIKE ?"); | |
$sth->execute($pattern, $pattern); |
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
$('div[id*="taxonomy-"]').find('input[type="checkbox"], input[type="radio"]').live('change', function(){ | |
setTimeout(function() { | |
acf.data.taxonomy = ['0']; | |
$('div[id*="taxonomy-"] input:checked').each(function(){ | |
acf.data.taxonomy.push($(this).val()) | |
}); | |
update_fields(); | |
}, 0); |
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
sub cleanup { | |
my $cv = AE::cv; | |
for my $irc ($self->ircs) { | |
$cv->begin; | |
$irc->reg_cb(disconnect => sub { $cv->end }); | |
$irc->disconnect; | |
} |
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; | |
use HTML::Parser; | |
my $len = 0; | |
my $max = 85; | |
my (@close, @open); |