Skip to content

Instantly share code, notes, and snippets.

@macdrifter
macdrifter / available_tasks.py
Last active May 27, 2018 05:11
Sublime Text function to display available tasks from a TaskPaper file. Looks for @start, @Due and @started tags with dates before today's date
import sublime, sublime_plugin
import re
import time
class AvailableTasksCommand(sublime_plugin.TextCommand):
def run(self, edit):
today_date = time.strftime('%Y-%m-%d')
self.available_marker = []
@macdrifter
macdrifter / list_projects.py
Created January 31, 2014 15:56
Sublime Text method for use with the TaskPaper format. Function to display list of all projects and allow jumping to one from the list.
import sublime, sublime_plugin
import re
# For use with the TaskPaper format. Function to display list of all projects and allow jumping to one from the list.
class ListProjectsCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.markers = []
@macdrifter
macdrifter / stringParser.py
Created August 15, 2013 13:57
stringParser
import sys
import re
import urllib
import clipboard
def titleCase(s):
newText = re.sub(r"[A-Za-z]+('[A-Za-z]+)?",lambda mo: mo.group(0)[0].upper() + mo.group(0)[1:].lower(),s)
return newText
print "Convert to:"
@macdrifter
macdrifter / 7DADBAF5-352B-498A-8A2D-E15C2A5EDDE8.wkflw
Created February 8, 2013 12:33
Editorial workflow to insert reference link
This gist contains a workflow for Editorial, an app for
writing plain text and markdown on iOS.
To import the workflow, copy the *entire* text of the gist,
then open Editorial and create a new workflow.
------------ BEGIN WORKFLOW ------------
{
"actions" : [
{
@macdrifter
macdrifter / CsvToArray.py
Created December 8, 2012 12:01 — forked from tony-landis/CsvToArray.py
Convert CSV string to fixed width text table
"""
Convert CSV string to fixed width text table. Supports multi-line rows, column width limits, and creates a header row automatically
@author Tony Landis
@link http://www.tonylandis.com
@license GPL
"""
from math import ceil
class CsvToTxt():
{
"actions" : [
{
"class" : "WorkflowActionRequestTextInput",
"parameters" : {
"multiLineOption" : 1,
"title" : "Append to Scratch"
}
},
{
@macdrifter
macdrifter / DropboxSync.py
Created November 13, 2012 22:46 — forked from wrenoud/DropboxSync.py
DropboxSync
import os
import sys
import pickle
import console
# I moved 'dropboxlogin' into a sub folder so it doesn't clutter my main folder
sys.path += [os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')]
import dropboxlogin # this code can be found here https://gist.github.com/4034526
STATE_FILE = '.dropbox_state'
https://itunes.apple.com/us/app/sql-ed/id475312085?mt=8
@macdrifter
macdrifter / get_links.py
Created October 18, 2012 22:53
get_links
@macdrifter
macdrifter / formd-pythonista.py
Created October 18, 2012 00:16 — forked from ttscoff/formd-pythonista.py
A modified version of formd for use with Pythonista on iOS
# encoding=utf8
"""
formd by Seth Brown, 02-24-12
modified for iOS use (Pythonista) by Brett Terpstra, 10-17-12
"""
from sys import stdin, stdout
import clipboard
import re
from collections import OrderedDict