Skip to content

Instantly share code, notes, and snippets.

David W. Keith davidwkeith

Block or report user

Report or block davidwkeith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@davidwkeith
davidwkeith / gosemver.go
Created Sep 27, 2018
Convert go version strings to semver compliant strings
View gosemver.go
package main
import (
"fmt"
"runtime"
"strings"
"github.com/coreos/go-semver/semver"
)
View davidwkeith.id
Verifying that "davidwkeith.id" is my Blockstack ID. https://onename.com/davidwkeith
@davidwkeith
davidwkeith / flickering.rb
Created Feb 6, 2016
Flickering candle effect for Halloween
View flickering.rb
require 'hue'
CANDLE_COLOR_RANGE = [*2000..2200] # Kelvin, 2000K is lowest Hue can do
CANDLE_BRIGHTNESS_RANGE = [*20..52]
bridge = Hue.application
candle = Hue::Bulb.new(bridge, 1)
candle.on if candle.off?
View kebase.md

Keybase proof

I hereby claim:

  • I am davidwkeith on github.
  • I am dwkeith (https://keybase.io/dwkeith) on keybase.
  • I have a public key whose fingerprint is 8AEE 1308 A48E C6BE 885B 89CD 7208 DB57 1364 E5E5

To claim this, I am signing this object:

@davidwkeith
davidwkeith / create_element.js
Created Jun 10, 2013
Example of document.createElement enhancement
View create_element.js
// not sure how to detect this yet, stay tuned or leave a comment
window.document._createElement = window.document.createElement;
window.document.createElement = function(name, attributes) {
if (typeOf attributes === 'string') {
// Chrome adds an undefined 'is' attribute for the second arg, why is this?
// Chrome is also throwing a TypeError for any third arg I can think of (number, string, object)
return window.document._createElement(arguments);
} else {
var elm = window.document._createElement(name);
@davidwkeith
davidwkeith / localization_helper.js
Created Jul 11, 2012
Localization Helper for Ember.js's Handlebars
View localization_helper.js
Handlebars.registerHelper('loc', function(property, fn) {
var str;
// we are bound to a value, it is now the context
if (fn.contexts && typeof fn.contexts[0] === 'string') {
str = fn.contexts[0];
// Convention, start all localization keys with _
} else if (property[0] === '_') {
str = property;
@davidwkeith
davidwkeith / index.html
Last active Oct 24, 2019
NOTE: This was a great hack in days gone by, but now both Apple and Google have improved their support for custom protocol handlers. Licensed under the WFTPL http://www.wtfpl.net/txt/copying/
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Redirection</title>
</head>
<body>
<!--
NOTE: This was a great hack in days gone by, but now both Apple and Google have improved their support for custom
protocol handlers.
You can’t perform that action at this time.