Skip to content

Instantly share code, notes, and snippets.

View jberger's full-sized avatar

Joel Berger jberger

View GitHub Profile
sub _inlinify_css_rules {
my $self = shift;
my $html = shift;
my $dom = Mojo::DOM->new($html);
for my $selector ( sort keys %rules ) {
my $styler = sub {
my $element = shift;
my $style = $element->attrs('style') // q{};
@dankrause
dankrause / _hover_example.py
Last active March 8, 2024 18:31
Example code to use the (unofficial, unsupported, undocumented) hover.com DNS API.
import requests
class HoverException(Exception):
pass
class HoverAPI(object):
def __init__(self, username, password):
params = {"username": username, "password": password}
r = requests.post("https://www.hover.com/api/login", params=params)
@jberger
jberger / URLQueue.pl
Last active November 10, 2022 20:58
Modularization of my answer from SO on URL queuing for non-blocking ua
#!/usr/bin/env perl
package Mojo::URLQueue;
use Mojo::Base 'Mojo::EventEmitter';
use Mojo::UserAgent;
has queue => sub { [] };
has ua => sub { Mojo::UserAgent->new(max_redirects => 5) };
has concurrency => 4;
@wchristian
wchristian / gist:5119725
Created March 8, 2013 20:45 — forked from anonymous/gist:5119721
xml::libxml on windows
13-03-08@21:19:28 (jdb) http://paste.stacka.to/gejavoyifo.pl
13-03-08@21:19:51 (jdb) This is the script that is called to build libxml on the PPM builders.
13-03-08@21:20:33 (jdb) It assumes the tarball is already unpacked and the CWD is the top-level directory inside the tarball
13-03-08@21:21:19 (jdb) http://paste.stacka.to/furanimeli.avrasm
13-03-08@21:21:31 (jdb) This is the "control file"
13-03-08@21:24:58 (Mithaldu) can you give me links for the iconv sources you use?
13-03-08@21:25:34 (jdb) https://code.google.com/p/win-iconv/
13-03-08@21:26:05 (Mithaldu) and zlib?
13-03-08@21:26:33 (jdb) http://paste.stacka.to/guhelixuwo.pl
13-03-08@21:27:04 (jdb) http://zlib.net/zlib-1.2.5.tar.gz
@pstuifzand
pstuifzand / MarpaX-JSON.pm
Last active December 10, 2015 14:28
A JSON parser in Marpa.
package MarpaX::JSON;
use strict;
use Marpa::R2 2.039_000;
sub new {
my ($class) = @_;
my $self = bless {}, $class;
$self->{grammar} = Marpa::R2::Scanless::G->new(
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: