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
use Modern::Perl; | |
use utf8; | |
use Carp; | |
use Want; | |
use CLASS; | |
use SUPER; | |
use autodie; | |
use autobox; | |
use autobox::Core; | |
use signatures; |
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
use strict; | |
sub foo { | |
interceptive_block { | |
bar(); | |
} intercept(baz => $baz) { | |
//$baz = 'baz' | |
} | |
} | |
sub bar { |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use SQL::Translator; | |
use File::Basename qw( basename dirname ); | |
use Cwd qw( realpath ); | |
use File::Temp qw( tempfile tempdir ); |
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
from django.core.files.storage import DefaultStorage | |
return DefaultStorage().url('/path/to/img.gif') |
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
(defun bf-pretty-print-xml-region (begin end) | |
"Pretty format XML markup in region. You need to have nxml-mode | |
http://www.emacswiki.org/cgi-bin/wiki/NxmlMode installed to do | |
this. The function inserts linebreaks to separate tags that have | |
nothing but whitespace between them. It then indents the markup | |
by using nxml's indentation rules." | |
(interactive "r") | |
(save-excursion | |
(nxml-mode) | |
(goto-char begin) |
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
print repr(structure) # they share the same syntax. |
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
def printshape(x): | |
children = lambda a: { printshape(b) for b in a } | |
fmt = lambda a,b: a.format("|".join(b)) | |
together = lambda a,b: fmt(a, children(b)) | |
if isinstance(x, list): | |
return together("list[{}]", x) | |
elif isinstance(x, set): | |
return together("set[{}]", x) | |
elif isinstance(x, tuple): | |
return together("tuple[{}]", x) |
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
use Text::CSV::Encoded; | |
use Encode qw(encode decode); | |
use autodie; | |
use feature ':5.16'; | |
use strict; | |
use warnings; | |
sub go { | |
my $lineno = 1; # Sadly, using Text::CSV to read the lines (necessary for | |
# correctly handling embedded newlines) breaks $. |
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
-- Multiply a Row Vector by a Column Vector | |
multPerpendicularVecs = zipWith (*) | |
-- Multiply 2 Row Vectors (ugh, that's not supposed to happen), or 2x Col Vecs | |
multParallelVecs a b = fmap (* (sum a)) b |
OlderNewer