Skip to content

Instantly share code, notes, and snippets.

@robjwells
robjwells / days.py
Last active December 21, 2015 05:19
days - print the number of days between now and a given date
#!/usr/local/bin/python3
"""\
Days
Calculate the number of days between a date and today or another date
Usage:
days <date> [<second_date> --format=<fmt>]
Options:
-f <fmt>, --format=<fmt> A strptime format string
@robjwells
robjwells / RJW Light.bbcolors
Created July 6, 2013 17:07
robjwells custom BBEdit colour scheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundColor</key>
<string>rgba(0.968627,0.968627,0.968627,1.000000)</string>
<key>CommentsColor</key>
<string>rgba(0.466667,0.466667,0.466667,1.000000)</string>
<key>CommentsColor_Markdown</key>
<string>rgba(0.466667,0.466667,0.466667,1.000000)</string>
@robjwells
robjwells / rjw-syntax-readme.md
Last active December 19, 2015 10:29
robjwells.com syntax highlighting

This is essentially Dr Drang’s script for syntax highlighting and adding line numbers to code snippets, which calls [highlight.js][hljs] to do the colouring.

My code is largely the same, but rewritten to not require JQuery and done so in the module pattern to keep functions out of the global namespace. (On [my site][rjw] this is my personal JavaScript file, so I’d also stick any other functions I write myself inside the module.)

@robjwells
robjwells / Prefixr.applescript
Created April 5, 2013 09:22
Prefixr AppleScript with formatting
tell application "BBEdit"
-- Get selection and call the Prefixr API
set theSel to the contents of the selection of text 1 of text window 1
set prefixed to (do shell script "curl -sSd css=\"" & theSel & "\" http://prefixr.com/api/index.php")
-- Calculate current indent
set initialSpaces to ""
repeat
set spaceOffset to the offset of " " in theSel
if spaceOffset is not 1 then
@robjwells
robjwells / Restart in Windows.applescript
Last active October 10, 2015 11:17
Quickly restart your Mac into Windows
set deviceID to (do shell script "diskutil list | awk '/YourBootcampPartition/ {print $NF}'")
do shell script "bless -device /dev/" & deviceID & " -legacy -setBoot -nextonly" ¬
with administrator privileges
tell application "Finder" to restart
@robjwells
robjwells / css-mobile.diff
Last active October 6, 2015 01:04
Dr Drang's CSS file with media queries
--- mobile.css 2015-10-05 20:11:57.000000000 +0100
+++ drang-combined.css 2015-10-05 22:59:05.000000000 +0100
@@ -41,17 +41,12 @@
}
#container {
-/*
- width: 52em;
- min-width: 660px;
- */
@robjwells
robjwells / robjwells.css
Created October 6, 2015 00:13
The 2013-era CSS file for robjwells.com
/* robjwells.com
By Rob Wells, 2013
Contents
> Reset
> Font import
> Grids
> Wrapper
> FOUT hide
> Type
@robjwells
robjwells / historical-dollars.py
Created July 15, 2015 22:18
Pythonista UI script that converts a dollar amount for a given year to current dollars
from __future__ import division
from datetime import date
from xml.etree import ElementTree
import requests
import ui
def calculate_amount(sender):
"""Convert given dollar amount for given year to current dollars"""

Keybase proof

I hereby claim:

  • I am robjwells on github.
  • I am robjwells (https://keybase.io/robjwells) on keybase.
  • I have a public key whose fingerprint is BF60 AE62 6723 EBC7 97CC 12A7 9E0A 4806 CFE9 E7D1

To claim this, I am signing this object: