Skip to content

Instantly share code, notes, and snippets.

Ole Zorn omz

Block or report user

Report or block omz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
omz / Check dictionary
Created Mar 10, 2016
Check dictionary
View Check dictionary
# coding: utf-8
Demo of using the built-in iOS dictionary to check words
NOTES: This is quite slow, it might be possible to use the spell-checking
dictionary for this instead, haven't tried that yet.
If no dictionary is downloaded yet, the API will always return True
(probably so that the "Define" menu item can be shown before
a dictionary has been downloaded).
omz /
Last active Jan 3, 2018
# coding: utf-8
This is a little helper script to make it easier
to create single-file scripts with Pythonista, while
still taking advantage of the UI editor.
It'll essentially convert the .pyui file to a compact
string representation that you can embed directly
in your script. The code to unpack and load the UI
is also auto-generated for convenience.
omz / Height map
Created Feb 29, 2016
Height map
View Height map
# coding: utf-8
# Optimized version of the code in this forum post:
from scene import *
import random
import ui
import math
def render_bottom_texture(width=100.0):
omz / File
Created Feb 22, 2016
View File
# coding: utf-8
import ui
import os
from objc_util import ObjCInstance, ObjCClass
from operator import attrgetter
import time
import threading
import functools
import ftplib
import re
omz / Barcode
Created Feb 19, 2016
View Barcode
# coding: utf-8
# Barcode scanner demo for Pythonista
# Based on
from objc_util import *
from ctypes import c_void_p
import ui
import sound
found_codes = set()
omz / Add Web
Last active Jun 7, 2017 — forked from steventroughtonsmith/Add Web
Insert a custom browser tab into Pythonista
View Add Web
# 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')
# coding: utf-8
# Stub generator for ui module
# * For classes, the base class is always assumed to be `object`. This isn't correct, but it shouldn't matter much because the
# generated stubs also contain inherited methods and data descriptors. Using the actual base classes would complicate things a
# little because the class definitions would have to appear in the correct order then.
# * It's not possible to get correct argspecs for functions and methods that are implemented in C, so they're always just
# `self, *args` (for bound methods) or `*args*` (for module-level functions) in the output.
import ui
omz /
Last active Feb 27, 2019 — forked from alessaba/
# coding: utf-8
from objc_util import *
import threading
NSBundle = ObjCClass('NSBundle')
LocalAuthentication = NSBundle.bundleWithPath_('/System/Library/Frameworks/LocalAuthentication.framework')
LAContext = ObjCClass('LAContext')
# authenticate() will raise one of these exceptions when authentication
omz / Pythonista Theme
Last active Mar 21, 2019
Pythonista Theme
View Pythonista Theme
# coding: utf-8
Basic theme editor for Pythonista 1.6 (beta)
WARNING: Use at your own risk! User themes aren't "officially" supported, and
this may break in future versions. If you enter invalid JSON or anything else
that the app can't deal with, it *will* crash -- your input is not validated
in any way.
# Utility functions for setting UI/syntax highlighting theme in Pythonista (1.6 beta) using objc_util. WARNING: This relies on some internals that may change in the future.
# When run as a script, it toggles between the default (light) theme and Tomorrow-Dark.
from objc_util import *
import os
import glob
def get_theme_names():
res_path = str(ObjCClass('NSBundle').mainBundle().resourcePath())
theme_paths = glob.glob(os.path.join(res_path, 'Themes2/*.json'))
You can’t perform that action at this time.