Skip to content

Instantly share code, notes, and snippets.


Doug Thompson snoopdouglas

View GitHub Profile
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'
import queryMap from 'query-map'
const transitionQueryParam = '__dynamic'
ready(() => {
if(queryMap[transitionQueryParam] === '1')
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&&('none')}}})();
snoopdouglas /
Created Sep 27, 2016
Copy random songs to an MP3 player until it's full
# NOTE you need coreutils for this - `brew install coreutils`
MUSIC_DIR="/Volumes/Shared/iTunes/iTunes Media/Music"
echo "this will erase everything in '$COPY_TO_DIR'."
while true; do
read -p "ok? [y/N] " yn
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>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link href="" rel="stylesheet">
<link href="/z1.css" rel="stylesheet">
snoopdouglas /
Last active Jul 22, 2016
One-liner to delete all ufw rules without disabling or reloading the firewall
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