Skip to content

Instantly share code, notes, and snippets.

View arodland's full-sized avatar

Andrew Rodland arodland

View GitHub Profile
A .-
B D.
C NN
D N.
E .]
F IN
G -N
H II
I ..
J W-
$_=uc<>;y,. ,|/,;s/./$& /g;@m{A..Z,0..9,qw(| , ?)}=".-D.NNN..]IN-NII..W-N-R.---.M-ANMAA.I.-].AIAA-NANMMIOMAOUMSMSASIB.MSOIONRKGWUD"=~/../g;1while s![]\w|,?]!$m{$&}!;print
my $books = $schema->resultset('Books'); # Knows how to find every book.
# Knows how to find books published in the 90s.
my $nineties_books = $schema->search({
published => { -between => [1990, 1999] }
});
# Knows how to find books published in the 90s that
# were awesome -- see how the state keeps getting added to?
get_field_index () {
FILENAME=$1
FIELD=$2
IFS=$'\t' read -a KEYS < $FILENAME
for i in `seq 0 $(( ${#KEYS[*]} - 1))` ; do
if [ "${KEYS[$i]}" = "$FIELD" ] ; then
echo $(( $i + 1 ))
return 0
$ ./perl6
> multi sub foo (Num $n where { $_ > 10 }) { say "$n is big!" }
> multi sub foo (Num $n) { say "$n is not so big" }
> foo(42);
42 is big!
> foo(3);
3 is not so big
sub finalize_error {
my $c = shift;
my $show_dump = (defined $c->config->{show_debugging_info})
? $c->config->{show_debugging_info}
: $c->beta; # beta is another method my app has... you can guess what it does.
if ($show_dump) {
# Let Catalyst::Plugin::StackTrace do its thing for dev
return $c->maybe::next::method();
var evtW = {};
function evtWait(name) {
var e = evtW[name];
if (!e) return false;
if (e.ready()) {
clearTimeout(e.timeout);
for (i = 0 ; i < e.list.length ; i++) e.list[i]();
delete evtW[name];
} else e.timeout = setTimeout("evtWait('"+name+"')", e.interval);
#!/bin/sh
while true; do
if ! /bin/pidof vpnc >/dev/null 2>&1 || ! ping -c 2 -w 10 192.168.10.249 >/dev/null 2>&1 ; then
if /usr/bin/killall vpnc >/dev/null 2>&1 ; then
while /bin/pidof vpnc >/dev/null 2>&1 ; do
/bin/sleep 5
done
fi
/usr/sbin/vpnc --non-inter
package Regexp::NegativeLookBehind;
use strict;
use warnings;
=head1 SYNOPSIS
my $assertion = Regexp::NegativeLookBehind->not_after(
'neplusultra',
'tough act to follow'
ok 1 - unpack works
ok 2 - substr works
ok 3 - regex works
1..3
Rate regex unpack substr
regex 298898/s -- -45% -67%
unpack 541032/s 81% -- -40%
substr 899326/s 201% 66% --