This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Image, ImageDraw, scene | |
def diagonalLineImage(inLength = 200, inColors = ('blue', 'ivory')): | |
imageLength = inLength + 100 # the image can be larger than what you draw | |
theImage = Image.new('RGBA', (imageLength, imageLength), inColors[1]) | |
draw = ImageDraw.Draw(theImage) | |
draw.line((0, 0, inLength, inLength), fill = inColors[0]) | |
del draw | |
return theImage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertToMilitaryTime( ampm, hours, minutes ) { | |
var militaryHours; | |
if( ampm == "am" ) { | |
militaryHours = hours; | |
// check for special case: midnight | |
if( militaryHours == "12" ) { militaryHours = "00"; } | |
} else { | |
if( ampm == "pm" || am == "p.m." ) { | |
// get the interger value of hours, then add | |
tempHours = parseInt( hours ) + 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clipboard | |
import urllib | |
import Image | |
import photos | |
import cStringIO | |
# Given an image URL in the clipboard, save the image to the iOS Camera Roll with Pythonista. Simple script with no error checks or other settings. | |
URL = clipboard.get() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import scene | |
keyboard_layouts = ( | |
''' | |
q w e r t y u i o p del | |
a s d f g h j k l return | |
z x c v b n m , . shift | |
.?123 space .?123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# To call script from Drafts, use the follwing URLs as URL Actions: | |
# - <pythonista://insert_location.py?action=run&argv=[[draft]]&argv=address> | |
# (Will insert the address of your current location.) | |
# - <pythonista://insert_location.py?action=run&argv=[[draft]]&argv=link> | |
# (Will insert a Google Maps link to your current location.) | |
import location | |
import re |
Dispatch registers the x-dispatch://
URL scheme and provides one public action: compose
.
Launches Dispatch with the composer screen prefilled using information provided in the parameters below.
Optional. Specifies the email address of the account to compose the new mail from. If there are more than one account configured in Dispatch, and no valid from
account is provided, Dispatch will default to using the first account configured in Dispatch to compose the mail.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bs4, collections, console, requests, scene | |
tkColorDict = collections.OrderedDict() # key = tkinter color name | |
def loadTkColorDict(): # will automaticly be called by getColor() if needed | |
tkColorURL = 'http://www.tcl.tk/man/tcl8.6/TkCmd/colors.htm' | |
print('Loading tkinter colors from: ' + tkColorURL) | |
tkColorSoup = bs4.BeautifulSoup(requests.get(tkColorURL).text).tbody | |
print('Soup is ready. Creating color table...') | |
for tableRow in tkColorSoup.find_all('tr'): |