Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am joeshaw on github.
  • I am joeshaw (https://keybase.io/joeshaw) on keybase.
  • I have a public key whose fingerprint is BA36 55E3 D96B C66F 9906 3967 C6AF 28BC 42DD 4DE2

To claim this, I am signing this object:

import datetime
def _parse_date(d):
if isinstance(d, datetime.date):
return d
elif isinstance(d, datetime.datetime):
return d.date()
else:
return datetime.datetime.strptime(d, '%Y-%m-%d').date()
@joeshaw
joeshaw / slack-nicknames.js
Created July 16, 2015 19:56
Using my shitty javascript skills to add Slack nicks to real names
function addNicks() {
$(".message_sender").map(function() {
var name = $(this).data("x-name");
if (!name) {
name = $(this).text();
$(this).data("x-name", name);
}
var href = $(this).attr("href");
if (href) {
var nick = href.slice(6);
@joeshaw
joeshaw / access.diff
Created January 29, 2011 03:21
add access(2) to node
diff --git i/lib/fs.js w/lib/fs.js
index d094462..ed21d56 100644
--- i/lib/fs.js
+++ w/lib/fs.js
@@ -401,6 +401,14 @@ fs.chownSync = function(path, uid, gid) {
return binding.chown(path, uid, gid);
};
+fs.access = function(path, amode, callback) {
+ binding.access(path, amode, callback || noop);
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by glib configure 2.28.7, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure --disable-dependency-tracking --disable-rebuilds --prefix=/usr/local/Cellar/glib/2.28.7 --with-libiconv=gnu --disable-debug
## --------- ##
## Platform. ##
Process: conftest [96252]
Path: /private/tmp/homebrew-glib-2.28.7-UJKs/glib-2.28.7/conftest
Identifier: conftest
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: sh [96251]
Date/Time: 2011-07-15 16:19:15.229 -0400
OS Version: Mac OS X 10.6.8 (10K540)
Report Version: 6
@joeshaw
joeshaw / monitrc
Created September 20, 2011 18:09
monit configuration
set daemon 10
set logfile /var/log/monit.log
set statefile /var/lib/monit/monit.state
set alert foo@example.com not { nonexist, action, instance }
include /etc/monit/conf.d/*
@joeshaw
joeshaw / gist:1943da15f4d799f2e729
Created November 10, 2015 16:14
Onename Verification Gist
Verifying that +joeshaw is my blockchain ID. https://onename.com/joeshaw
$ python benchmark.py
JSON
0.380753993988
SimpleJSON
0.363165855408
Protocol Buffer (fast)
0.131771087646
Protocol Buffer (standard)
2.89067387581
PALM
@joeshaw
joeshaw / addnicks.js
Created February 4, 2016 15:06
Display slack handles next to real names
function addNicks() {
$(".message_sender").map(function() {
var name = $(this).data("x-name");
if (!name) {
name = $(this).text();
$(this).data("x-name", name);
}
var href = $(this).attr("href");
if (href) {
var nick = href.slice(6);