Skip to content

Instantly share code, notes, and snippets.

View lorddoig's full-sized avatar

Sean Doig lorddoig

View GitHub Profile
@lorddoig
lorddoig / keybase.md
Created May 14, 2018 11:36
keybase.md

Keybase proof

I hereby claim:

  • I am lorddoig on github.
  • I am lorddoig (https://keybase.io/lorddoig) on keybase.
  • I have a public key whose fingerprint is 04F2 9A4A 21A5 CECD A99F 1465 50AB B78C 83C7 919F

To claim this, I am signing this object:

@lorddoig
lorddoig / rect.cljs
Created August 24, 2015 11:29
CLJS goog.math.Rect wrapper
(ns my-ns
(:refer-clojure :exclude [contains?])
(:require [goog.math.Rect :as grect])
(:import goog.math.Rect))
(defprotocol IRectangle
(bounding-rect [this other])
(ceil [this])
(contains? [this other])
(difference [this other])

Keybase proof

I hereby claim:

  • I am lorddoig on github.
  • I am lorddoig (https://keybase.io/lorddoig) on keybase.
  • I have a public key whose fingerprint is ED85 03D0 5807 2CFD 550B 917A 5BF9 124A E83D F235

To claim this, I am signing this object:

@lorddoig
lorddoig / gist:9420658
Created March 7, 2014 21:35
Regenerate server SSH keys
#!/bin/bash
set -e
if [ "$(id -u)" != "0" ]; then
echo "This script must be run with administrator privileges."
exit 1
fi
if [ -z "$(which ssh-keygen)" ]; then
echo "Required utility ssh-keygen does not appear to be installed."
# Regular Expression Validation for IPv6 addresses in Ruby
#
# Inspired by (if not to say copied from): http://forums.dartware.com/viewtopic.php?t=452
# Thanks, Dartware!
IPV6_REGEX = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f
@lorddoig
lorddoig / application.rb
Last active December 18, 2015 21:29
Rails: deal with HTTP OPTIONS requests in middleware
module AppName
# ...
class Application < Rails::Application
# ...
config.middleware.use "OptionRequests"
# ...
end
# ...
end