Skip to content

Instantly share code, notes, and snippets.

@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++;
@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 / 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,
});
.--------------------.
.---------| Dancer2::Core::App |-----------.------------.
| '--------------------' | |
| | | v
v | | .-----------------.
.--------------. | | | D2::C::Response |
| routes | | | '-----------------'
|--------------| | | .-----------------.
| D2::C::Route | | | | D2::C::Request |
@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;
@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
#!perl
use strict;
use warnings;
use IO::All;
use IO::All::LWP;
use Web::Query;
local $| = 1;
wq('http://podbay.fm/show/536258179')
@xsawyerx
xsawyerx / Eg1.pl
Last active August 29, 2015 14:08
Example Dancer2 setup
# app.pl:
use MyApp::Web;
use MyApp::Web::API;
use Plack::Builder;
builder {
mount '/' => MyApp::Web->to_app;
mount '/api' => MyApp::Web::API->to_app;
};
@xsawyerx
xsawyerx / ratings
Created March 2, 2014 14:48
MetaCPAN Ratings
MetaCPAN::API::Rating {
Parents Moo::Object
public methods (9) : author, date, details, distribution, helpful, new, rating, release, user
private methods (1) : _known_fields
internals: {
data {
author "PLACEHOLDER",
date "2014-03-02T12:20:07",
distribution "Moose",
rating 4.9,
use v5.10;
use MetaCPAN::API;
use Data::Dumper;
use List::AllUtils qw(min max);
use DateTime;
use DateTime::Format::ISO8601;
my @score_label = qw(
Abysmal
Poor