Skip to content

Instantly share code, notes, and snippets.

In the desert

Stephen Howells stephenhowells

In the desert
View GitHub Profile
stephenhowells / gist:4021772
Created Nov 6, 2012
Apache conf snippet to hide .git directories and .gitignore files.
View gist:4021772
# do not allow .git version control files to be issued
<Directorymatch "^/.*/\.git+/">
Order deny,allow
Deny from all
<Files ~ "^\.git">
Order allow,deny
Deny from all
stephenhowells / ia-writer_marked.applescript
Last active Apr 5, 2020
iA Writer AppleScript to preview text in Marked.
View ia-writer_marked.applescript
-- Preview the currently active iA Writer document using Marked.
tell application "iA Writer"
-- Ask iA Writer for it's active document.
set the_document to document 1
-- Save the document or prompt if not previously saved.
save the_document
View moment-holidays.js
//## Moment.JS Holiday Plugin
// Call .holiday() from any moment object. If date is a US Federal Holiday, name of the holiday will be returned.
// Otherwise, return nothing.
// Example:
// `moment('12/25/2013').holiday()` will return "Christmas Day"
stephenhowells / Gruntfile.js
Created Jan 26, 2014
LiveReload in Both Gulp and Grunt
View Gruntfile.js
module.exports = function(grunt) {
pkg: grunt.file.readJSON('package.json'),
watch: {
livereload: {
files: ['_site/*'],
options: {
livereload: true
stephenhowells /
Last active Jan 3, 2016
The Powerline install process for OS X 10.10
#!/usr/bin/env bash
# Check that /usr/local/bin comes before /usr/bin in your PATH
brew install python
brew install cmake
brew install libgit2
#! /usr/bin/python
from sys import argv
from os.path import exists
from os import makedirs
from os import symlink
import getopt
# Show Usage, Output to STDERR
stephenhowells / gist:6718627
Created Sep 26, 2013
Python Script to generate a policy and signature. Useful when using CORS uploads to S3.
View gist:6718627
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64, hmac, sha
private_key = 'YOUR PRIVATE KEY'
input = open("policy.txt", "rb")
policy =
policy_encoded = base64.b64encode(policy)
signature = base64.b64encode(, policy_encoded, sha).digest())
stephenhowells / no_widows.exs
Created Dec 23, 2015
Remove widows from blog post titles by adding a non breaking space in Elixir.
View no_widows.exs
defmodule Text do
def widows(some_str) do
title_list = some_str |> String.split(" ") |>
title_str = Enum.join(title_list, " ")
if Enum.count(title_list) > 2 do
String.replace(title_str, ~r/\s+\S*$/, "&nbsp;" <> List.last(title_list))
View gist:6604943
<title>S3 POST Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
var bucketName = 'MY_BUCKET_NAME';
var AWSKeyId = 'MY_AWS_KEY_ID';
var policy = 'MY_POLICY';
var signature = 'MY_SIGNATURE';
stephenhowells / no_widows.rb
Last active Dec 21, 2015
Remove widows in your blog post headings by adding an "&nbsp;" between the last two words in the title if it is three words or more.
View no_widows.rb
def no_widows(arg)
if arg.strip.count(" ") >= 2
arg.split[0...-1].join(" ") + "&nbsp;#{arg.split[-1]}"
#Example usage: