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
$('div[data-block-id]:has(div:contains("c8f6e963-f28b-444e-ad23-054d6d94f25d"))').waitUntilExists('div[data-block-id]:has(div:contains("c8f6e963-f28b-444e-ad23-054d6d94f25d"))', function() { | |
// Page has loaded | |
$('div[data-block-id]:has(div:contains("c8f6e963-f28b-444e-ad23-054d6d94f25d"))').css('display', 'none'); | |
$('div[data-block-id]:has(div:contains("Directory"))').css('display', 'none'); | |
$('a.notion-link-token.notion-enable-hover span').css('opacity', 1.0); | |
$('a:regex(href, ^((?!:\/\/).)*$)').removeAttr('target'); | |
$('a:regex(href, ^((?!:\/\/).)*$)').removeAttr('data-token-index'); | |
}, true); |
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
(function (e, f) { | |
var b = {}; | |
var g = function (a) { | |
if(b[a]) { | |
f.clearInterval(b[a]); | |
b[a] = null; | |
}; | |
}; | |
e.fn.waitUntilExists = function (s, h, o, c) { |
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
guard ( | |
!argument.isEmpty, | |
nums.count == arguments.count | |
) else { | |
print("Blah blah") | |
} |
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 UIKit | |
public protocol ConstraintStateMachineType: class { | |
// MARK: Types | |
typealias State: RawRepresentable | |
// MARK: Properties | |
var state: State? { get set } | |
var allConstraints: [NSLayoutConstraint] { get } | |
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
operator infix ~> { associativity right } | |
@infix func ~>(firstBlock: (() -> Void), secondBlock: (() -> Void)) -> (() -> Void) { | |
return { | |
dispatch_async(dispatch_get_global_queue(-32768, 0), { | |
firstBlock() | |
dispatch_async(dispatch_get_main_queue(), secondBlock) | |
}) | |
} | |
} |
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
def Enum(**kwargs): | |
values = kwargs | |
class EnumClass(type): | |
def __new__(cls, name, parents, dct): | |
# create a class_id if it's not specified | |
if 'class_id' not in dct: | |
dct['class_id'] = name.lower() | |
# we need to call type.__new__ to complete the initialization | |
new_type = super(EnumClass, cls).__new__(cls, name, parents, dct) |
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
class ContainedViewController: UIViewController { | |
weak var dataDelegate: FrameViewControllerDataDelegate? | |
override func willMoveToParentViewController(parent: UIViewController?) { | |
super.willMoveToParentViewController(parent) | |
self.dataDelegate = parent as? FrameViewControllerDataDelegate | |
} | |
override func viewDidAppear(animated: Bool) { | |
super.viewDidAppear(animated) |
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
class ViewController: UIViewController, ConstraintStateMachineType { | |
typealias State = Alignment | |
enum Alignment: String { | |
case Left = "Left" | |
case Right = "Right" | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
public extension ConstraintStateMachineType where Self: UIViewController { | |
// MARK: Properties | |
var allConstraints: [NSLayoutConstraint] { | |
return self.view.flatConstraints // helper function, recursively collects constraints | |
// https://gist.github.com/pcperini/5a8ea37e8cbbe904a031 | |
} | |
// MARK: Mutators | |
func setNeedsUpdateConstraints() { | |
self.view.setNeedsUpdateConstraints() |
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
public extension CollectionType { | |
// MARK: Flatteners | |
public func flatten(path: (Self.Generator.Element) -> [Self.Generator.Element]) -> [Self.Generator.Element] { | |
guard !self.isEmpty else { return [] } | |
return self + self.flatMap { path($0).flatten(path) } | |
} | |
} | |
public extension UIView { | |
// MARK: Properties |
NewerOlder