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
# turtle.py | |
# Basic Turtle graphics module for Pythonista | |
# | |
# When run as a script, the classic Koch snowflake is drawn as a demo. | |
# The module can also be used interactively or from other scripts: | |
# >>> from turtle import * | |
# >>> right(30) | |
# >>> forward(100) | |
# ... |
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
# A simple Evernote API demo script that lists all notebooks in the user's | |
# account and creates a simple test note in the default notebook. | |
# | |
# Before running this sample, you must fill in your Evernote developer token! | |
# | |
# This sample is part of the Evernote SDK and has been modified slightly for | |
# Pythonista, to take advantage of the clipboard and PIL modules. | |
# If there is an image in the clipboard when the script is run, it is attached | |
# to the sample note. |
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
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" : [ | |
{ |
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 -*- | |
# iTC Sales Report Downloader | |
# When you run this for the first time, you'll need to enter your | |
# iTunes Connect login and vendor ID. You can find the vendor ID | |
# on the iTunes Connect website by navigating to "Sales and Trends"; | |
# it's the number next to your name (top-left). | |
CURRENCY = 'EUR' | |
RESET_LOGIN = False # Set to True to remove login from keychain |
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 | |
''' | |
NOTE: This requires the latest beta of Pythonista 1.6 (build 160022) | |
Demo of a custom ui.View subclass that embeds a native map view using MapKit (via objc_util). Tap and hold the map to drop a pin. | |
The MapView class is designed to be reusable, but it doesn't implement *everything* you might need. I hope that the existing methods give you a basic idea of how to add new capabilities though. For reference, here's Apple's documentation about the underlying MKMapView class: http://developer.apple.com/library/ios/documentation/MapKit/reference/MKMapView_Class/index.html | |
If you make any changes to the OMMapViewDelegate class, you need to restart the app. Because this requires creating a new Objective-C class, the code can basically only run once per session (it's not safe to delete an Objective-C class at runtime as long as instances of the class potentially exist). | |
''' |
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
# install missing xmlrpclib module | |
import requests | |
r = requests.get('http://hg.python.org/cpython/raw-file/7db2a27c07be/Lib/xmlrpclib.py') | |
with open('xmlrpclib.py', 'w') as f: | |
f.write(r.text) | |
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
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" : [ | |
{ |
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
# Simple installer script for using the Evernote SDK in Pythonista | |
# | |
# This script should be run from the root directory. In order to keep things | |
# tidy, it installs the module and all its dependencies in a directory named | |
# 'evernote-sdk'. In order to be able to import it, you have to add that to | |
# your import path, like this: | |
# | |
# import sys | |
# sys.path.append('evernote-sdk') | |
# |
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
# Shows the location of the last photo in the canera roll in the Maps app. | |
# (thanks to @HyShai for pointing out that the latitude/longitude refs are necessary) | |
import photos | |
import webbrowser | |
meta = photos.get_metadata(-1) | |
gps = meta.get('{GPS}') | |
if gps: | |
latitude = str(gps.get('Latitude', 0.0)) + gps.get('LatitudeRef', '') |
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
# Example for sending an email with an attached image using smtplib | |
# | |
# IMPORTANT: You need to enter your email login in the main() function. | |
# The example is prepared for GMail, but other providers | |
# should be possible by changing the mail server. | |
import smtplib | |
from email.mime.base import MIMEBase | |
from email.mime.multipart import MIMEMultipart | |
from email import encoders |