View fruition-pcperini.js
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); |
View fruition-jquery-ext.js
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) { |
View guard_beaut.swift
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") | |
} |
View enum.py
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) |
View ContainedViewController.swift
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) |
View ViewController.swift
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() |
View ConstraintStateMachineType-ViewController.swift
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() |
View Helpers.swift
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 |
View ConstraintStateMachineType.swift
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 protocol ConstraintStateMachineType: class { | |
// MARK: Types | |
typealias State: RawRepresentable | |
// MARK: Properties | |
var state: State? { get set } | |
var allConstraints: [NSLayoutConstraint] { get } | |
// MARK: Mutators | |
func setNeedsUpdateConstraints() |
View StatefulConstraint.swift
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
@IBDesignable | |
public class StatefulConstraint: NSLayoutConstraint { | |
// MARK: Properties | |
@IBInspectable var state: String = "" | |
} |
NewerOlder