Skip to content

Instantly share code, notes, and snippets.

View rjbs's full-sized avatar
🤝
here to help

Ricardo Signes rjbs

🤝
here to help
View GitHub Profile
@rjbs
rjbs / pL-wtf.pl
Created February 3, 2009 14:40
a bug in [\pL] in perl5
# I can conceive of absolutely no reason why, in the following code, the @?pL
# variant would fail, but it does, in 8.008, 8.009, 10. -- rjbs, 2009-02-03
# It also fails in 5.12, but works in 5.14. -- rjbs, 2011-05
use strict;
use Test::More 'no_plan';
like(f => qr/[a-z]/, "a-z alone");
like(f => qr/[\pL]/, "pL alone");
like(f => qr/@?[a-z]/, "@? a-z");
@rjbs
rjbs / ailpon.pl
Created March 11, 2009 02:52
am I localpart or not?
#!/usr/bin/perl
use strict;
use warnings;
=head1 AM I LOCAL PART OR NOT??
This is a very verbose and inefficient way to demonstrate how you can validate
an RFC 822 email address local part. If a local part is not valid, it will
tell you why. -- rjbs, 2009-03-10
@rjbs
rjbs / paste.perl
Created March 12, 2009 00:18
YAML::XS fail
use strict;
use YAML::XS;
use Data::Dumper;
my $YAML = <<'END_YAML';
---
"foo": "bar"
[ 1, 2, 3 ] : "foo"
END_YAML
@rjbs
rjbs / Note.pm
Created April 8, 2009 16:54
Note.pm o/~ "Your mom."
package Note;
use base 'Exporter';
our @EXPORT = qw(o);
use overload '/' => sub {
my ($self, $other, $rev) = @_;
die "wtf" if $rev;
print "NOTE: " . (~ $other) . "\n";
};
@rjbs
rjbs / wtf.pl
Created November 10, 2009 17:35
abusing laziness for booleans
has is_finished => (
lazy => 1,
default => 1,
init_arg => undef,
predicate => 'is_finished',
reader => 'mark_finished',
);
@rjbs
rjbs / can-ver.pl
Created November 17, 2009 22:20
abusing prototype() for API version
# if ($obj->can('foo')) { ... }
# if ($obj->can('foo', $api_version)) { ... }
# if ($obj->can('foo', $api_version, $minor_version)) { ... }
use strict;
use Number::Nary qw(n_codec);
my $major = 10;
# Grammar for L<> in Pod5
link-code = "L<"
( link-text "|" ) ?
(link-target)
">"
link-text = [^|]+
@rjbs
rjbs / lp-login.user.js
Created December 17, 2009 19:52
userscript to log into LP forum
// ==UserScript==
// @name LP Forum Login
// @namespace http://rjbs.manxome.org/
// @description add submit handler to LP forum login to fix 1Password
// @include http://www.liquidplanner.com/forum-login/
// @include http://www.liquidplanner.com/process/Login
// ==/UserScript==
document.getElementById('password').value = 'xyzzy'; // except put your actual pw
updateStorableFields();
@rjbs
rjbs / moose-rap.txt
Last active September 4, 2015 04:14
the #moose rap log
15:39 <@rjbs> Last night, I dreamed I was a rapper.
15:39 <@rjbs> I was asked to come to the funeral of a fan I had never met and
eulogize her.
15:40 <@arcanez> did you?
15:40 <@autarch> and you laid down some mad rhymez there?
15:41 <@rjbs> No, I did my best to do a good job. I think I was part of a duo
and my counterpart did not take things as seriously.
15:41 <@hanekomu> certainly repressed sexual desires or traumatic events, as
Freud would say. :)
15:42 * rjbs watches the cornfield out the window.