Skip to content

Instantly share code, notes, and snippets.

Avatar

Doug Thompson snoopdouglas

View GitHub Profile
@snoopdouglas
snoopdouglas / push-state-static.js
Created Sep 18, 2018
Tiny Barba.js-esque push-state static page transitioner
View push-state-static.js
// "wait for ready or just run immediately" function
import ready from 'ready'
// https://stackoverflow.com/a/21210643
import queryMap from 'query-map'
const transitionQueryParam = '__dynamic'
ready(() => {
if(queryMap[transitionQueryParam] === '1')
return
@snoopdouglas
snoopdouglas / crowdfire-oneliner.js
Last active Jul 25, 2017
Remove CrowdFire tweets from your stream (need to make a Chrome plugin out of this…)
View crowdfire-oneliner.js
(()=>{var a=document.querySelectorAll('.stream-item');for(var b=0;b<a.length;b++){var c=a[b];if(c.children[0]&&c.children[0].classList.contains('js-original-tweet')){var h=c.querySelector('.tweet-text').innerText,j=h.match(/ via @[a-z0-9_]+( #[a-z0-9_])*$/i);j&&(c.style.display='none')}}})();
@snoopdouglas
snoopdouglas / refresh-tunes.sh
Created Sep 27, 2016
Copy random songs to an MP3 player until it's full
View refresh-tunes.sh
#!/bin/bash
# NOTE you need coreutils for this - `brew install coreutils`
MUSIC_DIR="/Volumes/Shared/iTunes/iTunes Media/Music"
COPY_TO_DIR="/Volumes/LABEOUF/MUSIC"
echo "this will erase everything in '$COPY_TO_DIR'."
while true; do
read -p "ok? [y/N] " yn
@snoopdouglas
snoopdouglas / canvas-with-data.html
Last active Aug 2, 2016
Render entire page using 2D canvas while keeping data visible to crawlers/screen readers
View canvas-with-data.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.2/normalize.min.css" rel="stylesheet">
<link href="/z1.css" rel="stylesheet">
<title>Canvas</title>
</head>
<body>
@snoopdouglas
snoopdouglas / ufw-delete-all.sh
Last active Jul 22, 2016
One-liner to delete all ufw rules without disabling or reloading the firewall
View ufw-delete-all.sh
for j in $(for i in $(sudo ufw status numbered | (grep -E '[0-9]+/(tc|ud)p' |awk -F"[][]" '{print $2}') ) ; do echo $i ; done | tac) ; do sudo ufw --force delete $j ; done