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:
I hereby claim:
To claim this, I am signing this object:
| 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""" |
| /* robjwells.com | |
| By Rob Wells, 2013 | |
| Contents | |
| > Reset | |
| > Font import | |
| > Grids | |
| > Wrapper | |
| > FOUT hide | |
| > Type |
| --- 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; | |
| - */ |
| 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 |
| 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 |
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.)
| <?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> |
| #!/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 |
| #!/bin/bash | |
| if [ $# -eq 0 ]; then | |
| echo 'usage: scat FILE [...]' | |
| fi | |
| for arg in "$@"; do | |
| echo "===> $arg:" | |
| cat -n "$arg" | |
| echo |