Skip to content

Instantly share code, notes, and snippets.

View joewright's full-sized avatar
🕶️
🤳 🌭

Joe Wright joewright

🕶️
🤳 🌭
View GitHub Profile
@joewright
joewright / publix-scraper.js
Last active November 22, 2020 17:31
grocery list scraper
const itemClass = 'title clamp-2';
printItems();
function printItems() {
const items = document.getElementsByClassName(itemClass);
const uniq = [];
let output = '';
@joewright
joewright / _promises.js
Last active February 21, 2019 20:48
minimal promise example
// bare minimum promise implementation
function promise() {
// the promise caller will pass these along in `then`
this.successFn = function() {};
this.errorFn = function() {};
}
promise.prototype.resolve = function(result) {
this.successFn(result);
};
@joewright
joewright / httplib.py
Created February 8, 2019 16:11
Python 3 httplib
import http.client
BAD_REQUEST = http.client.BAD_REQUEST
FORBIDDEN = http.client.FORBIDDEN
FOUND = http.client.FOUND
NOT_FOUND = http.client.NOT_FOUND
OK = http.client.OK
UNPROCESSABLE_ENTITY = http.client.UNPROCESSABLE_ENTITY
@joewright
joewright / ip-address-range.js
Created December 20, 2018 23:04
ip address range match
console.log('something');
const _ = require('lodash');
const { assert } = require('chai');
const SAMPLE_RULES_BLOCK = [
['103.1.108.1','AU'],
['3.254.254.254','US'],
['5.10.64.17','CN'],
['0.0.0.0-0.12.13.14','FR'],
['209.88.2.2-209.88.2.255','AZ'],
@joewright
joewright / Dockerfile
Last active December 20, 2018 18:44
scrape a website with wget
FROM alpine
RUN apk --update add openssl wget && \
# cleanup
rm -rf /var/cache/apk/*
@joewright
joewright / stream-it.js
Last active December 19, 2018 19:36
Stream html responses
const http = require('http');
const port = 3000;
const hostname = '127.0.0.1';
const max = 25;
const delay = 200;
const htmlOpen = `
<!DOCTYPE html>
<html>
<head>
@joewright
joewright / sort-it-up.js
Created September 13, 2018 16:34
_.sortBy example
var data = [{
active: false,
lastName: 'johnson'
}, {
active: true,
lastName: 'wow'
}, {
active: false,
lastName: 'awesome'
}, {
@joewright
joewright / .npmrc
Created September 4, 2018 14:12
an npmrc file for maximum success
save-exact=true
package-lock=false

Keybase proof

I hereby claim:

  • I am joewright on github.
  • I am joewrong (https://keybase.io/joewrong) on keybase.
  • I have a public key whose fingerprint is 52FF 655A 1A00 9554 EC36 B15F D5BE 2B1E B7B6 4823

To claim this, I am signing this object:

@joewright
joewright / sort_em.sh
Last active July 19, 2018 02:25
Sort flash drive for car stereo
# list disks
diskutil list
# unmount the unsorted drive
diskutil unmount /dev/disk2s1
# do the thing
fatsort /dev/disk2s1