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
// MARK: NSDate + Compare | |
public func <(a: NSDate, b: NSDate) -> Bool { | |
return a.compare(b) == .OrderedAscending | |
} | |
public func ==(a: NSDate, b: NSDate) -> Bool { | |
return a.compare(b) == .OrderedSame | |
} | |
extension NSDate: Comparable { } |
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
$('body').css({ | |
'background-color' : 'white', | |
'font-family' : 'Avenir-Roman', | |
'line-height' : '200%' | |
}); | |
$('div').css({ | |
'color' : 'black', | |
'font-size' : '110%' | |
}); |
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 twitter | |
import json | |
import urllib | |
import contacts | |
import console | |
from objc_util import * | |
import ui | |
import os | |
from PIL import Image | |
import webbrowser |
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
extension SequenceType where Generator.Element : Equatable { | |
/// Returns `self`, excluding `element` | |
@warn_unused_result | |
public func excluding(element: Self.Generator.Element) -> [Self.Generator.Element] { | |
return self.filter({$0 != element}) | |
} | |
public func excluding(element: [Self.Generator.Element]) -> [Self.Generator.Element] { | |
return self.filter({!(element.contains($0))}) | |
} |
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 | |
import console | |
from objc_util import * | |
console.clear() | |
importFramework('MediaPlayer') | |
MPMediaPickerController = ObjCClass('MPMediaPickerController') |
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 objc_util import * | |
class ImportFrameworkError(Exception): | |
def __init__(self, name): | |
self.name = name | |
def __str__(self): | |
return 'Couldn\'t import {}.framewrork. (Neither from public, nor from private frameworks)'.format(self.name) |
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 os | |
import sys | |
import plistlib | |
def get_bundle_identifier(): | |
plist = plistlib.readPlist(os.path.abspath(os.path.join(sys.executable, '..', 'Info.plist'))) | |
return '{CFBundleIdentifier}'.format(**plist) | |
def is_pythonista_3(): | |
return get_bundle_identifier() == 'com.omz-software.Pythonista3' |
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 photos | |
def pick_an_image(show_albums=False, include_metadata=False, original=True, raw_data=False, multi=False): | |
assets = photos.get_assets() | |
return photos.pick_asset(assets, multi=multi).get_image() | |
photos.pick_image = pick_an_image |
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 python3 | |
# Copyright (c) 2016 Lukas Kollmer<[email protected]> | |
from ctypes import * | |
from objc_util import ObjCClass | |
NSProcessInfo = ObjCClass('NSProcessInfo') | |
NSByteCountFormatter = ObjCClass('NSByteCountFormatter') |
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
// | |
// UIFont+CustomFont.m | |
// | |
// Created by Lukas Kollmer on 6/13/15. | |
// Copyright (c) 2015 Lukas Kollmer. All rights reserved. | |
// | |
@import UIKit; | |
#import <objc/runtime.h> |
OlderNewer