Skip to content

Instantly share code, notes, and snippets.

@Pulichev
Pulichev / UniversalFramework.sh
Created September 10, 2019 07:26
Create universal framework
#!/bin/sh
# build-framework-ios.sh
#
set -e # causes the shell to exit if any subcommand or pipeline returns a non-zero status.
set +u
# Avoid recursively calling this script.
if [[ $SF_MASTER_SCRIPT_RUNNING ]] ; then
exit 0
fi
set -u # causes the shell to exit if any undefined variable is referenced, `set +u` turns off
@Pulichev
Pulichev / UIViewControllerSwizzling.swift
Last active August 29, 2019 08:56
UIViewController viewDidLoad swizzling example
extension UIViewController {
static let shared : UIViewController = {
$0.initialize()
return $0
} (UIViewController())
func initialize() {
let swizzleClosure: () = {
UIViewController().swizzleViewDidLoad()
Paste it to JavaScript console.
var items = document.getElementsByClassName("load-diff-button btn-link width-full position-absolute top-0 left-0 height-full f4 no-underline js-diff-load");
for (var i = 0; i < items.length; i++) {
items[i].click();
}
extension Date {
static func dateFromISO8601String(_ string: String) -> Date? {
var tm = Darwin.tm()
strptime(string.cString(using: String.Encoding.utf8)!, "%Y-%m-%dT%H:%M:%S", &tm)
tm.tm_isdst = -1
return Date(timeIntervalSince1970: TimeInterval(mktime(&tm)))
}
}
func testExample() {
app.launchArguments.append("--clearuser")
app.launch()
expectation(for: exists, evaluatedWith: app.buttons["Other options"], handler: nil)
waitForExpectations(timeout: 20, handler: nil)
snapshot("Auth")
app.buttons["Other options"].tap()
app.buttons["Sign In"].tap()
let cache = ImageCache.default
cache.clearMemoryCache()
cache.clearDiskCache()