Skip to content

Instantly share code, notes, and snippets.

View clipperhouse's full-sized avatar

Matt Sherman clipperhouse

View GitHub Profile
@clipperhouse
clipperhouse / medium2md.go
Last active April 29, 2019 18:23
A Go script to convert Medium export (HTML) to Markdown, for use with Hugo. It’s a one-use type of thing for me, so it ain’t beautiful.
// A quick script for converting Medium HTML files to Markdown, suitable for use in a static file generator such as Hugo or Jekyll
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"regexp"
@clipperhouse
clipperhouse / runereader.go
Created May 21, 2018 22:29
A PeekRune method for bufio.Reader
package jargon
import (
"bufio"
"fmt"
"io"
"unicode/utf8"
)
type RuneReader struct {
@clipperhouse
clipperhouse / SublimeHere.md
Last active January 1, 2020 10:35
Open Sublime Text in current Finder folder

First you need subl at the command line. Use this:

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

...which came from Sublime's documentation here.

Next, open (Apple)Script Editor and paste this in:

tell application "Finder"
@clipperhouse
clipperhouse / winapps.ps1
Last active March 28, 2017 09:40
Removing consumer apps and undesirable SDKs from Windows and Visual Studio
# caveat emptor, this worked for me, be careful, your milage may vary
# to remove “consumer” Windows Store apps like Weather, Finance, News from Windows 8:
# http://blogs.technet.com/b/deploymentguys/archive/2012/10/26/removing-built-in-applications-from-windows-8.aspx
# remove the apps from the current user account. it will clean up your start screen, basically.
# you will likely see errors when this runs, but it’s still effective
Get-AppXPackage | Remove-AppxPackage
# this removes the apps from the machine entirely
### Keybase proof
I hereby claim:
* I am clipperhouse on github.
* I am clipperhouse (https://keybase.io/clipperhouse) on keybase.
* I have a public key whose fingerprint is 313A 2FCD DCDB F06D 9B77 2202 3833 566E 1DBF E9C5
To claim this, I am signing this object:
@clipperhouse
clipperhouse / stackrss.go
Created September 21, 2013 18:05
[go-pkg-rss] Why are item.Title’s not coming back?
package main
import (
"fmt"
rss "github.com/jteeuwen/go-pkg-rss"
"net/http"
"os"
)
var items []*rss.Item
@clipperhouse
clipperhouse / browserProgress.js
Last active May 23, 2019 04:49
Trigger the browser's progress spinner via jQuery.
/*
One disadvantage of ajax is that the user does not see the browser’s progress UI. Typically this is
a spinner that takes the place of the favicon in the browser tab while waiting for assets to download.
I believe this to be an important piece of UI. The browser vendors think so, too, otherwise it wouldn’t
be there.
How to emulate it? By adding an element to the DOM that is waiting to download. Below, this is done
with an iframe.
@clipperhouse
clipperhouse / gist:4205171
Created December 4, 2012 15:30
A handy collection of diacritics
ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ
@clipperhouse
clipperhouse / gist:2321739
Created April 6, 2012 18:11
Cross-platform mobile orientation change detection
if (window.onorientationchange) {
window.onorientationchange = updateOrientation;
} else {
window.onresize = updateOrientation;
}
var body = $(document.body);
function updateOrientation() {
var islandscape = window.orientation != null ? window.orientation != 0 : window.innerWidth > window.innerHeight;
body.toggleClass("landscape", islandscape);
}
@clipperhouse
clipperhouse / gist:1201239
Created September 7, 2011 17:50
CSS minifier in one line
var minified = Regex.Replace(css, @"\s*([,>+;:}{]{1})\s*", "$1").Replace(";}", "}");
// ...where css is a string containing valid CSS
// There are several ways to optimize this; I would use a compiled regex and
// put it in an extension method for ease of use
public static class Extensions {
static Extensions() // static constructor