Skip to content

Instantly share code, notes, and snippets.

jsbain

Block or report user

Report or block jsbain

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
View Untitled_20.py
from scene import *
from math import floor
class SceneTimers(Scene):
def setup(self):
t1=LabelNode()
t2=LabelNode()
t3=LabelNode()
View plotView.py
import ui
import numpy as np
W=1024
import time
from objc_util import *
CAShapeLayer=ObjCClass('CAShapeLayer')
View audioengine.py
from objc_util import *
AVAudioEngine = ObjCClass('AVAudioEngine').alloc().init()
AVAudioSession = ObjCClass('AVAudioSession')
AVAudioRecorder = ObjCClass('AVAudioRecorder')
shared_session = AVAudioSession.sharedInstance()
category_set= shared_session.setCategory_withOptions_error_(
ns('AVAudioSessionCategoryRecord'),
0x2, #duckothers
None)
View objc_classes.py
from objc_util import *
import weakref
import functools
''' Attempt at making more natural objc class in pythonista.
decorate python class with @objclass to create an ObjCClass.
set superclass and protocols class attributes, if desired.
View Untitled_5.py
import ui
class PointShowingView(ui.View):
def __init__(self,*args,**kwargs):
ui.View.__init__(self,*args,**kwargs)
self.p=(150,150)
self.color=(0.5,0.5,.5)
def draw(self):
ui.set_color(self.color)
ui.Path.rect(*self.p,100,100).fill()
View Untitled_215.py
# coding: utf-8
from objc_util import *
import ui
def printMethods(whichObject):
#print (dir(whichObject))
for method in dir(whichObject):
View multirecord.py
import sound
import ui
from math import floor
class RecorderView(ui.View):
'''simple metering view, attached to a recorder'''
def __init__(self, filename, callback=None, *args,**kwargs):
ui.View.__init__(self,*args,**kwargs)
View multirecord.py
import sound
import ui
from math import floor
class RecorderView(ui.View):
'''simple metering view, attached to a recorder'''
def __init__(self, filename, *args,**kwargs):
ui.View.__init__(self,*args,**kwargs)
@jsbain
jsbain / notification_center.py
Created Nov 18, 2018
notification_center.py
View notification_center.py
from objc_util import *
import console
from functools import partial
NSNotificationCenter=ObjCClass('NSNotificationCenter')
#logging.basicConfig(filename='log.txt',format='%(levelname)s:%(message)s', level=logging.DEBUG)
class NotificationObserver(object):
View audiounit_lib.py
from ctypes import *
from objc_util import c
AudioUnitRenderActionFlags=c_uint32
OSStatus=c_int32
OSType=c_uint32
class SMPTETimeType(c_uint32):
kSMPTETimeType24 = 0
kSMPTETimeType25 = 1
kSMPTETimeType30Drop = 2
kSMPTETimeType30 = 3
You can’t perform that action at this time.