Skip to content

Instantly share code, notes, and snippets.

@wearhere
wearhere / arrays.swift
Last active August 29, 2015 14:02
Swift arrays are bullshit.
import Cocoa
let anArray = [1, 2, 3]
// Given `func foo(arr: Int[])`,
// how can it ensure the immutability of _arr_?
// 1. Won't work because `unshare` can only be called on vars.
//func foo(arr: Int[]) {
// arr.unshare()
@wearhere
wearhere / Foo.swift
Last active August 29, 2015 14:02
Separate interfaces and implementations, including private implementations, in Swift.
import Cocoa
class Foo {
/// Public interface
var message: String?
let logMessage: () -> Void
init(message: String) {
// define a placeholder for `self`, for use within functions in this initializer
// in advance of `self` being fully initialized
@wearhere
wearhere / TableViewCellTest.m
Last active August 29, 2015 14:02
Examining table view cells using Subliminal.
#import <Subliminal/Subliminal.h>
@interface TableViewCellTest : SLTest
@end
@implementation TableViewCellTest
- (void)setUpTest {
[super setUpTest];
// navigate to the table view
@wearhere
wearhere / SubclassTargetTest.m
Last active August 29, 2015 14:04
Test a superclass can register instances of subclasses for Subliminal app hooks.
#import <Subliminal/Subliminal.h>
/// The superclass
@interface SLSelfRegisteringAppTarget : NSObject
@end
@implementation SLSelfRegisteringAppTarget
- (id)init {
self = [super init];
@wearhere
wearhere / doublecheck_isEnabled.diff
Last active August 29, 2015 14:04
Workaround for `UIAElement.isEnabled` sometimes returning false positives.
diff --git a/Sources/Classes/UIAutomation/User Interface Elements/SLElement.m b/Sources/Classes/UIAutomation/User Interface Elements/SLElement.m
index 375cba2..2cac09a 100644
--- a/Sources/Classes/UIAutomation/User Interface Elements/SLElement.m
+++ b/Sources/Classes/UIAutomation/User Interface Elements/SLElement.m
@@ -362,6 +362,22 @@ UIAccessibilityTraits SLUIAccessibilityTraitAny = 0;
return isVisible;
}
+- (BOOL)isEnabled {
+ __block BOOL isEnabled = [super isEnabled];
@wearhere
wearhere / testMatchingDetailDisclosureButton.patch
Created August 12, 2014 04:29
Attempting to match a table view cell detail disclosure button using Subliminal. Patch on https://github.com/inkling/Subliminal/commit/29c7c9692d8df1f5e79196a02b5bebe027a150fb. Test passes.
diff --git a/Integration Tests/Tests/SLElementMatchingTest.m b/Integration Tests/Tests/SLElementMatchingTest.m
index 3c61e55..7bf2412 100644
--- a/Integration Tests/Tests/SLElementMatchingTest.m
+++ b/Integration Tests/Tests/SLElementMatchingTest.m
@@ -284,6 +284,17 @@
SLAssertTrue([rightLabel isValid], @"Could not match UITableView header child element.");
}
+- (void)focus_testMatchingTableViewCellDetailDisclosureButton {
+ // Detail disclosure buttons take their accessibility labels from those of
@wearhere
wearhere / injectScript.js
Last active August 29, 2015 14:11
How the Mixmax Chrome extension injects the application JS: https://www.mixmax.com/blog/what-to-do-when-your-app-breaks
var script = document.createElement('script');
script.src = 'https://d1j5o6e2vipffp.cloudfront.net/src/build.js';
script.crossOrigin = 'anonymous';
document.head.appendChild(script);
"content_security_policy": "script-src 'self' https://d1j5o6e2vipffp.cloudfront.net; object-src 'self'; frame-src 'self' https://app.mixmax.com"
//script.crossOrigin = 'anonymous';
// router.js
Router.configure({
waitOn: function() {
// Required in all views.
return Meteor.subscribe('userpreferences', ['theme']);
}
});
Router.route('availability', {
path: '/availability',