This file contains 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
A .- | |
B D. | |
C NN | |
D N. | |
E .] | |
F IN | |
G -N | |
H II | |
I .. | |
J W- |
This file contains 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
$_=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 |
This file contains 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
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? |
This file contains 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
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 |
This file contains 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
$ ./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 |
This file contains 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 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(); |
This file contains 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
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); |
This file contains 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
#!/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 |
This file contains 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
package Regexp::NegativeLookBehind; | |
use strict; | |
use warnings; | |
=head1 SYNOPSIS | |
my $assertion = Regexp::NegativeLookBehind->not_after( | |
'neplusultra', | |
'tough act to follow' |
This file contains 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
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% -- |