Skip to content

Instantly share code, notes, and snippets.

@bron84
bron84 / save_py3.py
Created June 15, 2016 06:12
save_py3.py
# coding: utf-8
import appex, console
import ui
import os.path
import os
import clipboard
import gc
import shutil
@bron84
bron84 / platform_info_mod.py
Created June 15, 2016 05:29
platform_info_mod.py
import inspect, platform
for name, value in inspect.getmembers(platform):
if name[0] != '_' and callable(value):
try:
value = value()
except (IndexError, TypeError):
continue
if str(value).strip("( ,')"):
print('{:>21}() = {}'.format(name, value))
@bron84
bron84 / form_dialog_from_fields_dict_py3.py
Created June 3, 2016 08:28
form_dialog_from_fields_dict_py3.py
# coding: utf-8
import collections, dialogs
# simplify the creation of simple form_dialogs
def form_dialog_from_fields_dict(title, fields_dict):
return dialogs.form_dialog(title, [{'title': k, 'type': v}
for k, v in fields_dict.items()])
@bron84
bron84 / filedownloader.py
Created June 1, 2016 07:15 — forked from bitoffdev/filedownloader.py
filedownloader.py
# Python file downloader for Pythonista by OMZ Software
# By: EJM Software ---- http://ejm.cloudvent.net
# Source: https://gist.github.com/89edf288a15fde45682a
# *****************************************
# This simple script uses the requests module to download files
# and the ui module to show a progress bar
# You can use this bookmarklet to download files from Safari:
# javascript:window.location='pythonista://filedownloader?action=run&argv='+encodeURIComponent(document.location.href);
import ui, console, clipboard, sys, requests, zipfile
@bron84
bron84 / showAllInstalledApllications.py
Created May 18, 2016 02:39
showAllInstalledApllications.py
from objc_util import *
appWorkspace = ObjCClass('LSApplicationWorkspace')
default = (appWorkspace.defaultWorkspace)
list = appWorkspace.defaultWorkspace()
apps = list.allInstalledApplications()
for app in apps:
print(app)
@bron84
bron84 / Foundation.py
Created May 1, 2016 06:19 — forked from steventroughtonsmith/Foundation.py
UIKit+UIFoundation & Foundation for Pythonista - autoconverted from SDK tbd (includes non-public SPI)
# coding: utf-8
from objc_util import *
NSAKDeserializer = ObjCClass('NSAKDeserializer')
NSAKDeserializerStream = ObjCClass('NSAKDeserializerStream')
NSAKSerializer = ObjCClass('NSAKSerializer')
NSAKSerializerStream = ObjCClass('NSAKSerializerStream')
NSAbstractLayoutGuide = ObjCClass('NSAbstractLayoutGuide')
NSAddressCheckingResult = ObjCClass('NSAddressCheckingResult')
NSAffineTransform = ObjCClass('NSAffineTransform')
@bron84
bron84 / Add_Web_Tab_Py3.py
Created May 1, 2016 04:58
Add_Web_Tab_Py3.py
# coding: utf-8
from objc_util import *
import console
import urllib.request, urllib.parse, urllib.error
import dialogs
WKWebView = ObjCClass('WKWebView')
UIViewController = ObjCClass('UIViewController')
UIBarButtonItem = ObjCClass('UIBarButtonItem')
NSURLRequest = ObjCClass('NSURLRequest')
@bron84
bron84 / Add Web Tab Py3.py
Created April 24, 2016 02:06
Add Web Tab Py3.py
# coding: utf-8
from objc_util import *
import console
import urllib.request, urllib.parse, urllib.error
import dialogs
WKWebView = ObjCClass('WKWebView')
UIViewController = ObjCClass('UIViewController')
UIBarButtonItem = ObjCClass('UIBarButtonItem')
NSURLRequest = ObjCClass('NSURLRequest')
@bron84
bron84 / Add Web Tab.py
Created April 24, 2016 02:03 — forked from omz/Add Web Tab.py
Insert a custom browser tab into Pythonista
# coding: utf-8
from objc_util import *
import console
import urllib
import dialogs
WKWebView = ObjCClass('WKWebView')
UIViewController = ObjCClass('UIViewController')
UIBarButtonItem = ObjCClass('UIBarButtonItem')
NSURLRequest = ObjCClass('NSURLRequest')
@bron84
bron84 / AddWebTabs.py
Created April 23, 2016 04:07
AddWebTabs.py
# coding: utf-8
from objc_util import *
import console
import urllib.request, urllib.parse, urllib.error
import dialogs
WKWebView = ObjCClass('WKWebView')
UIViewController = ObjCClass('UIViewController')
UIBarButtonItem = ObjCClass('UIBarButtonItem')