Skip to content

Instantly share code, notes, and snippets.

View thomasjpr's full-sized avatar

Thomas Roberts thomasjpr

View GitHub Profile

Keybase proof

I hereby claim:

  • I am thomasjpr on github.
  • I am thomasjpr (https://keybase.io/thomasjpr) on keybase.
  • I have a public key ASBgtUE00deKDQFZAyx_I-W3w3hR0AAsJRLLr8NmabvoLQo

To claim this, I am signing this object:

@thomasjpr
thomasjpr / bbedit-new-markdown-note-to-dropbox.scpt
Created June 13, 2014 23:39
Create a new Markdown document in BBEdit and save the new file to a predetermined location, prompting the user to rename it. I keep all of my "notes" in a folder in my Dropbox.
tell application "BBEdit"
activate
make new document
set theDate to short date string of (current date)
set text of document 1 to theDate as text
save document 1 to "/Users/YOURUSERNAME/Dropbox/Notes/NewNote.md"
set old_name to name of text window 1
set dialog_result to display dialog "" default answer (theDate) & " - " & ¬
".md" buttons {"Cancel", "Save"} default button 2 ¬
with icon note ¬
@thomasjpr
thomasjpr / bbedit-open-file-in-foldingtext.scpt
Created June 13, 2014 20:28
Open BBEdit doc in FoldingText
-- Open the currently active BBEdit document using FoldingText.
tell application "BBEdit"
activate
-- Ask BBEdit for it's active document.
set the_document to active document of text window 1
-- If the file doesn't alreay exist, ask the user to save it.
if not the_document's on disk then
save the_document
@thomasjpr
thomasjpr / pipe-to-tab.pl
Created April 13, 2014 17:18
pipe-to-tab.pl
#!/usr/bin/perl
use File::Basename qw(basename);
$me = basename ($0);
if ( $#ARGV < 0 )
{
print "Usage : $me <CSV File Name>\n";
exit;
@thomasjpr
thomasjpr / pipe-to-comma.pl
Created April 13, 2014 15:24
convert pipe-delimited input to comma-delimited output
#!/usr/bin/perl
use File::Basename qw(basename);
$me = basename ($0);
if ( $#ARGV < 0 )
{
print "Usage : $me <CSV File Name>\n";
exit;
@thomasjpr
thomasjpr / mobile browser regex
Created March 6, 2014 15:55
PHP regex to detect mobile browsers
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i
@thomasjpr
thomasjpr / insert timestamp
Created January 5, 2014 19:41
insert timestamp for sublime text.
# -*- coding: utf-8 -*-
from datetime import datetime
import sublime_plugin
class TimestampCommand(sublime_plugin.EventListener):
"""Expand `isoD`, `now`, `datetime`, `utcnow`, `utcdatetime`,
`date` and `time`
"""
#!/usr/bin/env python
# MapQuest API Turn-by-turn script
#
# Generates driving directions from a starting location
# to a series of destinations in a CSV, used to print
# maps for volunteers delivering food to the less-fortunate
#
# CSV format - place in a file named `list.csv`
# Name, Street, Zipcode, Phone, Count