Skip to content

Instantly share code, notes, and snippets.

View petdance's full-sized avatar

Andy Lester petdance

View GitHub Profile
use strict;
use warnings;
use Test::Tester;
use Test::More tests => 1;
use TW::Test::More;
check_test( sub { is_fs_custnum( 'GARBAGECRAP' ) }, { ok => 0 }, 'Garbage should fail' );
use strict;
use warnings;
use Test::Tester;
use Test::More tests => 1;
use TW::Test::More;
#check_test( sub { is_fs_custnum( 'GARBAGECRAP' ) }, { ok => 0 }, 'Garbage should fail' );
$ cat foo.t
#!/var/perl/bin/perl
use strict;
use warnings;
use lib '/home/alester/Test-Simple-1.302085/blib/lib';
use Test::Tester;
use Test::More tests => 1;
@petdance
petdance / gist:0f1b9e37750cd443bc4bad4b467e7454
Created July 14, 2017 02:07
Why does \Q not work here?
#!perl
use warnings;
use strict;
use 5.010;
use Data::Dumper;
my $re = '\Qfoo(';
warn Dumper( $re );
Here's how I built a sidebar with sections in Jekyll:
```{% comment %}
The sections for the sidebar are managed through _data/sections.yml. We load
them in the order they're declared (`site.data.sections`), then loop through
each section and list any pages.
To allow pages to be ordered without explicitly requiring it, we sort by
weight. The lower the weight, the higher a page floats in the order (get it?).
{% endcomment %}
{% assign sections = site.data.sections %}
Usage: ack [OPTION]... PATTERN [FILES OR DIRECTORIES]
Search for PATTERN in each source file in the tree from the current
directory on down. If any files or directories are specified, then
only those files and directories are checked. ack may also search
STDIN, but only if no file or directory arguments are specified,
or if one of them is "-".
Default switches may be specified in ACK_OPTIONS environment variable or
an .ackrc file. If you want no dependency on the environment, turn it
#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
sub every(\%) {
my $hash = shift;
my $id = "$hash";
Testing under Perl 5.026000, /home/andy/perl5/perlbrew/perls/perl-5.26.0/bin/perl
| 1.96 | 2.22 | 2.999_01 | 2.999_02 | 2.999_03 | HEAD | grep | ag | rg
--------------------------------------------------------------------------------------------------------------------------
ack foo /home/andy/linux/ | 11.24 | 14.60 | 16.85 | 8.02 | 6.16 | 6.19 | 1.30 | 2.23 | 0.84
| HEAD | grep | ag | rg
------------------------------------------------------------------------
ack foo /home/andy/parrot/ | 0.43 | 0.08 | 0.09 | 0.08
ack foo -w /home/andy/parrot/ | 0.40 | 0.08 | 0.08 | 0.09
ack foo\w+ -w /home/andy/parrot/ | 0.36 | 0.09 | 0.12 | 0.07
ack foo\w+ -C10 /home/andy/parrot/ | 0.52 | 0.09 | 0.14 | 0.07
ack (set|get)_\w+ /home/andy/parrot/ | 0.82 | 0.18 | 0.18 | 0.08
------------------------------------------------------------------------
Total | 2.53 | 0.52 | 0.61 | 0.39
<!DOCTYPE html>
<html>
<head>
<title> </title>
</head>
<body>
<link href="https://cdnjs.cloudflare.com/ajax/libs/tabulator/3.5.2/css/tabulator.min.css" rel="stylesheet">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tabulator/3.5.2/js/tabulator.min.js"></script>
<div>
START OF TABLE