import unittest
class TestAModule(unittest.TestCase):
def setUp(self):
# create test data
pass
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
from mojo.UI import exportPreferences | |
import os.path | |
homeDir = os.path.expanduser("~") | |
exportPreferences("%s/Library/Mobile Documents/com~apple~CloudDocs/Preferences/Robofont/settings" %homeDir) |
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
Show hidden characters
{ | |
"cmd": ["robofont", "-p", "$file"], | |
"file_regex": "^[ ]File \"(...?)\", line ([0-9]*)", | |
"selector": "source.python", | |
} |
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
from mojo.events import addObserver, removeObserver | |
from vanilla import Window | |
class RoboFontDefconExample(): | |
def __init__(self): | |
self.w = Window((300, 120), "Debuggin window") | |
self.fonts = {} | |
for f in AllFonts(): | |
self._addFont(f) |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Sublime Text 3 Pipenv virtualenv helper. | |
1. Automatically find and set Pipenv virtualenv for each opened Python file. | |
- It uses `pipenv --venv` command to find the virtualenv. | |
- It will add a 'virtualenv' setting, which is the full path to the virtualenv, |
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 AppKit | |
from vanilla import * | |
myHotKeys = {'⌘s', '⇧⌘s', '⌘q', '⇧⌘q'} | |
MODIFIER_INT_TO_STR = { | |
1048840: '⌘', | |
262401: '⌃', | |
524576: '⌥', | |
131330: '⇧', |
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 ctypes | |
import ctypes.util | |
import objc | |
import CoreFoundation | |
""" | |
Find currently availabe keyboard layout input sources in Mac OSX using pyobjc. Based on: | |
https://gist.github.com/tiann/f85e89bef4b6e9b83f2a | |
""" |
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
""" | |
You can use this to get the window name if it has become the key window in | |
RoboFont. But the same data model can be used to create notifications inside | |
objc apps. | |
""" | |
from objc import python_method | |
import AppKit | |
from vanilla import FloatingWindow | |
from lib.tools.debugTools import ClassNameIncrementer |
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 time | |
def timeit(method): | |
def timed(*args, **kw): | |
ts = time.time() | |
result = method(*args, **kw) | |
te = time.time() | |
if 'log_time' in kw: | |
name = kw.get('log_name', method.__name__.upper()) | |
kw['log_time'][name] = int((te - ts) * 1000) | |
else: |
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 re | |
from collections import namedtuple | |
Token = namedtuple('Token', ['type', 'value', 'line', 'column']) | |
class Lexer(object): | |
_KEYWORDS = { | |
'if': 'IF_CONDITION', | |
'while': 'WHILE_LOOP', |
OlderNewer