Skip to content

Instantly share code, notes, and snippets.

View swilliams's full-sized avatar
stuff

Scott Williams swilliams

stuff
View GitHub Profile
@swilliams
swilliams / harvest.js
Created June 25, 2017 21:26
A bell provider for Harvest
import axios from 'axios';
import Bell from 'bell';
import Boom from 'boom';
import Joi from 'joi';
const harvestProvider = (options) => {
const validated = Joi.validate(options, Joi.object({
domain: Joi.string()
.hostname()
.required(),
extension String {
var localized: String {
return NSLocalizedString(self, comment: "")
}
}
// Which allows for:
"Hello world".localized
@swilliams
swilliams / gist:dddc46e5998bcc4d78dc
Created March 13, 2015 15:07
Xcode 6.2 Crash log
Process: Xcode [1419]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 6.2 (6776)
Build Info: IDEFrameworks-6776000000000000~11
App Item ID: 497799835
App External ID: 811890240
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [1419]
@swilliams
swilliams / gist:e16fc29d8942de489daf
Last active August 29, 2015 14:13
Get Markdown Link from Safari
tell application "Safari"
set theURL to URL of current tab of window 1
set theTitle to name of current tab of window 1
set the clipboard to "[" & theTitle & "](" & theURL & ")"
end tell
@swilliams
swilliams / projblame
Created April 30, 2014 20:47
Run git blame on a repository and group results by committer
#!/bin/sh
# Requires gnu sed to work.
git ls-tree -r HEAD|sed -re 's/^.{53}//'|while read filename; do file "$filename"; done|grep -E ': .*text'|sed -r -e 's/: .*//'|while read filename; do git blame -w "$filename"; done|sed -r -e 's/.*\((.*)[0-9]{4}-[0-9]{2}-[0-9]{2} .*/\1/' -e 's/ +$//'|sort|uniq -c

Keybase proof

I hereby claim:

  • I am swilliams on github.
  • I am swilliams (https://keybase.io/swilliams) on keybase.
  • I have a public key whose fingerprint is 9A61 2380 B522 6B56 5BC8 938B 6B8A 69FD D619 766D

To claim this, I am signing this object:

@swilliams
swilliams / gist:5528743
Created May 6, 2013 22:25
Currying FTW
var tag = 'div',
attrs = { className: 'foo', id: 'bar' },
slice = Array.prototype.slice;
isContent = function(c) {
var un = "undefined";
return c !== null && typeof c !== un &&
(typeof c.nodeType !== un ||
typeof c === "string");
}
@swilliams
swilliams / gist:1331268
Created November 1, 2011 17:28
SelectList of US States
var states = new List<SelectListItem> {
new SelectListItem { Value = "AL", Text = "Alabama" },
new SelectListItem { Value = "AK", Text = "Alaska" },
new SelectListItem { Value = "AZ", Text = "Arizona" },
new SelectListItem { Value = "AR", Text = "Arkansas" },
new SelectListItem { Value = "CA", Text = "California" },
new SelectListItem { Value = "CO", Text = "Colorado" },
new SelectListItem { Value = "CT", Text = "Connecticut" },
new SelectListItem { Value = "DE", Text = "Delaware" },
new SelectListItem { Value = "FL", Text = "Florida" },
@swilliams
swilliams / StudioTether.scpt
Created August 18, 2011 17:43
Calling the StudioTether Trigger
tell application "System Events"
tell process "StudioTether"
click button 2 of window "D300"
end tell
end tell