Skip to content

Instantly share code, notes, and snippets.

View eaton's full-sized avatar

Eaton eaton

View GitHub Profile
@mattfysh
mattfysh / example.ts
Created October 8, 2022 01:44
xpath compatibility with parse5 and htmlparser2 tree
import { parse } from 'parse5'
import { adapter } from 'parse5-htmlparser2-tree-adapter'
import xpath from 'xpath'
const html = '...'
const selector = '...'
const doc = parse(html, { treeAdapter: adapter })
const htmlEl = doc.childNodes.find(c => c.name === 'html')
const pw = require('playwright');
const UserAgent = require('user-agents');
const uuid = require('uuid');
const tmp = require('tmp-promise');
const UINT32_MAX = (2 ** 32) - 1;
const WEBGL_RENDERERS = ['ANGLE (NVIDIA Quadro 2000M Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (NVIDIA Quadro K420 Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (NVIDIA Quadro 2000M Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (NVIDIA Quadro K2000M Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (ATI Radeon HD 3800 Series Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics 4000 Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics 4000 Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (AMD Radeon R9 200 Series Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D
@artlung
artlung / ~filo-stanford-940520-bin-index.pl
Created April 11, 2021 19:30
~filo/stanford/940520/bin/index.html
#! /usr/local/bin/perl
require 'ctime.pl';
require 'newgetopt.pl';
#require '/usr/local/lib/perl5/ctime.pl';
#require '/usr/local/lib/perl5/newgetopt.pl';
#require '/usr/local/lib/perl5/sys/socket.ph';
#
# ----> parse_hotlist <----
# takes a file (default /chronos/c1/jerry/.hotlist
@marccarre
marccarre / list_kindle_releases.py
Created October 24, 2020 08:46
List all available versions of Kindle for Mac and Kindle for PC.
#!/usr/bin/env python
'''
List all available versions of Kindle for Mac and Kindle for PC.
Dependencies:
- asyncio==3.4.3
- aiohttp==3.6.3
'''
import os
import sys
@dreness
dreness / iShapeParser.py
Created July 22, 2020 20:29
Export Keynote shapes to SVG
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json # Native JSON Library
import argparse # Native Argument parser Library
# This is a slightly updated version of a script found on ye cyberwebs to
# add batch conversion support. Just don't specify an image ID to export the world.
# ==============================#
@XavierGimenez
XavierGimenez / README.md
Last active February 17, 2023 03:11
Sankey diagram with vega.js
@stborchert
stborchert / custommodule.drush.inc
Created February 18, 2016 13:23
Drupal: Drush command to refresh default config for modules/themes/profiles.
<?php
/**
* @file
* Drush commands.
*/
use Drupal\Core\Config\ConfigInstaller;
use Drupal\Core\Config\FileStorage;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\StorageInterface;

Development Contract Killer

A fork of the popular open-source contract for web designers and developers by Stuff & Nonsense, reworded for developers


Between us [company name] and you [customer name]

@ftrain
ftrain / rhymes.clj
Last active July 14, 2023 22:20
Annotated rhyming dictionary
;; This is at: https://gist.github.com/8655399
;; So we want a rhyming dictionary in Clojure. Jack Rusher put up
;; this code here:
;;
;; https://gist.github.com/jackrusher/8640437
;;
;; I'm going to study this code and learn as I go.
;;
;; First I put it in a namespace.
add_filter( 'image_send_to_editor', 'tiny_force_caption', 100 );
function tiny_force_caption( $html ) {
$a = strpos($html, 'caption');
if ($a!=1) {
preg_match('/(alignnone|alignleft|alignright|aligncenter)/', $html,$c);
preg_match('/width="(\d*)"/', $html,$w);
preg_match('/alt="([^"]*)"/', $html,$m);
preg_match('/wp-image-(\d*)"/', $html,$n);
if (!isset($n[1])) $n[1] = '0';
$html = '[caption id="attachment_'.$n[1].'" align="'.($c?$c[1]:'alignnone').'" width="'.$w[1].'"]'.$html." &copy; ".get_bloginfo('title')."[/caption]";