Skip to content

Instantly share code, notes, and snippets.

@xsawyerx
xsawyerx / benchmark.txt
Created August 25, 2015 17:51
HTTP::Headers vs. HTTP::Headers::Fast vs. HTTP::Headers::Fast::XS
How to read the statistics:
* Implementations:
- "orig" -> HTTP::Headers
- "fast" -> HTTP::Headers::Fast
- "fast_xs" -> HTTP::Headers::Fast::XS
* Time: how long it took to run
* Percentages: Improvement in percentages.
(these are not the same as with Benchmark.pm)
$ perl -Iblib/lib/ -Iblib/arch/ tools/dumbbenchmark.pl push_header push_header_many get_header set_header
@xsawyerx
xsawyerx / MyApp.pm
Last active January 2, 2016 00:21
uri_for() with parameters
package MyApp;
use Carp;
use Dancer2;
my %routes;
sub uri_for_it {
my ( $name, $vars ) = @_;
my $route = $routes{$name};
my $route_path = $route->spec_route;
.--------------------.
.---------| Dancer2::Core::App |-----------.------------.
| '--------------------' | |
| | | v
v | | .-----------------.
.--------------. | | | D2::C::Response |
| routes | | | '-----------------'
|--------------| | | .-----------------.
| D2::C::Route | | | | D2::C::Request |
@xsawyerx
xsawyerx / async-file-serving-without-send_file.pl
Last active January 5, 2017 12:47
Dancer2 asynchronous file serving without `send_file` with extra stuff
use Dancer2;
use Text::CSV_XS qw< csv >;
use Path::Tiny qw< path >;
use JSON::MaybeXS qw< encode_json >;
# Create a CSV parser
my $csv = Text::CSV_XS->new({
'binary' => 1,
'auto_diag' => 1,
});
@xsawyerx
xsawyerx / With.pm
Created March 20, 2017 14:53
Dancer2::Plugin::With
package Dancer2::Plugin::With;
use strict;
use warnings;
use Dancer2::Plugin;
plugin_keywords( qw< add_with route_with > );
has 'with_reg' => (
'is' => 'ro',
@xsawyerx
xsawyerx / remove.js
Created February 7, 2022 10:10
Remove all Twitter followers and likes
// These may take a bit to run, depending on how much you have,
// but you should be done by morning if you leave it over night with the right configuration
// Open Twitter profile likes page
// Copy paste the minified jquery straight into the console
// Adjust the interval and count as you wish
var count = 1;
var interval = setInterval( clearLikes, 600 );
function clearLikes() {
count++;