Skip to content

Instantly share code, notes, and snippets.

@dougharris
dougharris / export-stashes.sh
Created December 23, 2020 16:09
Script for exporting git stashes
#!/bin/bash
STASH_DIR="${HOME}/src/stash-patches"
PROJECT=$(basename $(pwd))
mkdir -p "${STASH_DIR}/${PROJECT}"
git stash list | while read -r ref stash
do
name=$(echo $stash | awk -F': ' '{printf("%s", $2);}' | tr -c '[:alnum:]_-' '-' | tr -s '-')
@dougharris
dougharris / main.py
Created May 13, 2018 18:39
CircuitPython code to treat Adafruit Gemma.M0 as a simple combination lock
# Simple combination lock style code for typing a password.
# (code adapted from the demo code installed on the Gemma.M0 in the
# swag bags at PyCon 2018)
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from digitalio import DigitalInOut, Direction
from touchio import TouchIn
import adafruit_dotstar as dotstar
import board
import time
@dougharris
dougharris / HideFacebookLogin.md
Last active August 28, 2017 19:45
Bookmarklet to hide the login/join panel that appears on Facebook.

Scenario: You're trying to find out information about a restaurant or event on Facebook but you're not logged into Facebook. Maybe it's because you're not a member or maybe because you try not to use Facebook at work.

Either way, you're stuck with this big white box blocking what you'd like to read.

Here's a bookmarklet for getting rid of that box:

javascript:(function()%7Bdocument.getElementById('pagelet_growth_expanding_cta').style.display %3D 'none'%7D)()

If you don't know how to install a bookmarklet, search the web for "install bookmarklet" or try this page

The climate change before & after feature has some issues with its javascript. It's reloading alternate versions javascript libraries that are already loaded as part of the main page and it's reloading them multiple times. Please update as follows.

First, remove this from every renderHTML component:

<script type="text/javascript" src="http://www.slate.com/content/dam/slate/blogs/browbeat/2013/02/erase-test_natalie/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="http://www.slate.com/content/dam/slate/blogs/browbeat/2013/02/erase-test_natalie/jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript" src="http://www.slate.com/content/dam/slate/blogs/browbeat/2013/02/erase-test_natalie/jquery.beforeafter-1.3.min.js"></script>
@dougharris
dougharris / before-after-fixed.html
Created September 30, 2013 16:17
Before and after with a more unique identifier
<script type="text/javascript">
$(function(){
$('#pakistan_before_after').beforeAfter({imagePath:'js/'});
});
</script>
<!-- other content was here but removed for this example -->
<div id="contentfortest">
<div id="pakistan_before_after">
@dougharris
dougharris / before-after-orig.html
Last active December 24, 2015 07:49
Before and after (original)
<script type="text/javascript" src="http://slate.com/features/2013/09/draggable/jquery-ui-1.10.3.custom.min.js"></script>
<script type="text/javascript"
src="http://www.slate.com/content/dam/slate/blogs/browbeat/2013/02/erase-test_natalie/jquery.beforeafter-1.3.min.js"></script>
<script type="text/javascript">
$(function(){
$('#container').beforeAfter({imagePath:'js/'});
$('#container1').beforeAfter({imagePath:'js/'});
});
</script>
23.09.2013 00:36:53.265 *ERROR* [pool-5-thread-1] com.slate.cq.services.PartnersFeedServiceImpl Could not parse: http://nervecenter.slate.com/tracker/api/?api_key=UQd7Wl4BRHWzUsRuHqzEetdrvtn92Ebje1mMv2gF org.apache.sling.commons.json.JSONException: A JSONObject text must begin with '{' at character 1 of <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
[no address given] and inform them of the time the error occurred,