Skip to content

Instantly share code, notes, and snippets.

View stephenhowells's full-sized avatar
🏜️
In the desert

Stephen Howells stephenhowells

🏜️
In the desert
View GitHub Profile
@stephenhowells
stephenhowells / Markdown.sublime-settings
Created October 17, 2014 15:15
Syntax specific settings for Markdown files in Sublime Text 3 using the Markdown Editing package.
{
"extensions":
[
"markdown",
"md",
"mdown",
"txt"
],
"wrap_width": 80,
"font_size": 15,
#!/bin/bash
# Encode a WAV to a finalized podcast MP3 with metadata, in the current directory
# Requires lame
# With Homebrew on Mac OS X: brew install lame
SHOW_AUTHOR="ATP"
EPISODE_NUMBER=104
EPISODE_TITLE="Minutiæ"
@stephenhowells
stephenhowells / no_widows.exs
Created December 23, 2015 22:38
Remove widows from blog post titles by adding a non breaking space in Elixir.
defmodule Text do
def widows(some_str) do
title_list = some_str |> String.split(" ") |> Enum.map(&String.capitalize/1)
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))
else
title_str
end
end