Skip to content

Instantly share code, notes, and snippets.

@chansen
chansen / NoticeableChanges.md
Created May 7, 2018 13:52
Noticeable changes in Property Aliases and Property Value Aliases

Noticeable changes in Property Aliases and Property Value Aliases

PropertyAliases.txt

3.2:
 + NBrk;Non_Break
 + WSpace;White_Space
 + scc;Special_Case_Condition
 + sfc;Simple_Case_Folding

4.0:

@chansen
chansen / results.txt
Created November 16, 2015 19:47
Faster UTF-X validation (~ 50% - 300% faster)
perl: 5.022000 (darwin 14.5.0)
ar.txt: code points: 14308 (U+0000..U+007F: 2698 U+0080..U+07FF: 11610)
Rate core this
core 26873/s -- -33%
this 39928/s 49% --
el.txt: code points: 58748 (U+0000..U+007F: 13560 U+0080..U+07FF: 45150 U+0800..U+FFFF: 38)
Rate core this
@chansen
chansen / id_rsa.pub
Created October 15, 2015 16:32
id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvkbSjboxgPOsq6rbKxww8taPipuM17Fj9xURQjIkEiunb+6mBumR+ct1d//O5Va6/t/srAg14KeQWEY6Ody+EC8DVI02TtX4buBc1rAL7BCRarLrTJCNYpJ9VLhu+h/u2x/3SgdMfHsBKbs65jqDIsSooXjyuJz3GDWrMDculQqwCiGGhkNPkzjdB1cXIOt8PEMRYV8/A/yqZtfIgd9lumT069m3xc1uKSScSpTSI4BeLMRTfydh5JlLATrBEPqHT/Iudb8xy37YdO0v0Et03eL5j8BID7RAZlnNq6ECV22doqBZ2UrfYnaqY/HeiekqaY52vNnATZ0pXlRItKvkuw== [email protected]
@chansen
chansen / result.txt
Last active August 29, 2015 14:25
Benchmark of slurping UTF-8 encoded file in Perl
$ perl benchmarks/slurp.pl
perl: 5.023001 (darwin 14.4.0)
Encode: 2.75
Unicode::UTF8: 0.60
PerlIO::encoding: 0.21
PerlIO::utf8_strict: 0.006
ar.txt: Size: 25918 Code points: 14308 (U+0000..U+007F: 2698 U+0080..U+07FF: 11610)
Rate :encoding(UTF-8) Encode :utf8_strict Unicode::UTF8
@chansen
chansen / ago.pl
Created July 10, 2015 20:59
Simple and efficient formatting of relative date/time using Time::Moment
#!/usr/bin/perl
use strict;
use warnings;
use Carp qw[];
use Time::Moment 0.19 qw[];
sub YEAR () { 365.2425 }
sub MONTH () { YEAR / 12 }
sub DAY () { 1 }
@chansen
chansen / benchmark.txt
Created October 13, 2014 19:21
Unicode::UTF8 vs Encode
$ perl benchmarks/bench.pl
perl: 5.020001 (darwin 13.3.0)
Encode: 2.60
Unicode::UTF8: 0.60
ar.txt: code points: 14308 (U+0000..U+007F: 2698 U+0080..U+07FF: 11610)
Rate Encode Unicode::UTF8
Encode 4121/s -- -83%
Unicode::UTF8 24613/s 497% --
@chansen
chansen / extract.pl
Created October 26, 2013 00:47
Extracts name and filename values from Content-Disposition header in multipart/form-data
#!/usr/bin/perl
use strict;
use warnings;
# <https://bugzilla.mozilla.org/show_bug.cgi?id=136676>
# <https://bugs.webkit.org/show_bug.cgi?id=62107>
# <https://www.w3.org/Bugs/Public/show_bug.cgi?id=16909>
# extracts name and filename values from Content-Disposition header.
# returns the escaped value, due to different behaviour across browsers. (see below)
@chansen
chansen / eigen.pl
Created September 6, 2013 12:30
Transparent singleton methods in Perl
#!/usr/bin/perl
use strict;
use warnings;
# Transparent singleton methods in Perl
# First a new anonymous class is created to hold the object's singleton
# methods, this anonymous class assumes the role of the object's class
# and the original class is designated as the super class of that anonymous
# class. This is completely transparent and the anonymous class can't be
# referenced by name.
package unicode;
use strict;
use warnings;
use warnings::register;
use Carp qw[croak cluck];
use Encode qw[];
# from perl.h verified in 5.6.2, 5.8.9, 5.10.1 and blead (2010-02-27)
sub HINT_BLOCK_SCOPE () { 0x00000100 }
@chansen
chansen / perlio-scalar-eof.patch
Created March 25, 2012 23:36
PerlIO::scalar patch
diff --git a/ext/PerlIO-scalar/scalar.xs b/ext/PerlIO-scalar/scalar.xs
index eac682b..d324bdd 100644
--- a/ext/PerlIO-scalar/scalar.xs
+++ b/ext/PerlIO-scalar/scalar.xs
@@ -125,6 +125,18 @@ PerlIOScalar_tell(pTHX_ PerlIO * f)
return s->posn;
}
+IV
+PerlIOScalar_eof(pTHX_ PerlIO * f)