Skip to content

Instantly share code, notes, and snippets.

@wearhere
wearhere / gist:5754953
Last active December 18, 2015 08:29
Call the "download book" app hook registered here: https://gist.github.com/wearhere/5754948. http://inkling.github.io/Subliminal
[[SLTestController sharedTestController] sendAction:@selector(downloadBookWithId:) withObject:titleId];
@wearhere
wearhere / keymandorc.rb
Created January 13, 2014 21:59
Enable OS X text navigation keyboard shortcuts in the Terminal using Keymando: http://keymando.com/.
start_at_login
only "Terminal" do
# Beginning/end of line
map "<Cmd-Left>", "<Ctrl-a>"
map "<Cmd-Right>", "<Ctrl-e>"
# Previous/next word
map "<Alt-Left>", "<Alt-b>"
map "<Alt-Right>", "<Alt-f>"
@wearhere
wearhere / shell.swift
Last active March 5, 2021 01:29
Shell scripting in Swift, using a proper hashbang and a custom subshell operator.
#!/usr/bin/xcrun swift -i -sdk /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
//
// shell.swift
//
// Shell scripting in Swift, using a proper hashbang and a custom subshell operator.
// To run: `chmod +x shell.swift && ./shell.swift`.
//
// If you edit this in Xcode, ignore the error on the hashbang line.
// To play around with this in a playground, comment out the hashbang line.
//
@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 / build_errors
Created July 24, 2014 21:12
Trying to build the `linphone` SDK.`
~/D/D/l/s/build (subliminal|✚2) $ make all
Broadcasting target 'all' to all sub-architectures
make -f builder-iphone-simulator.mk enable_gpl_third_parties=yes enable_zrtp=yes enable_opus=yes enable_debug=no enable_ffmpeg=yes enable_tunnel=no all \
&& make -f builder-iphone-os.mk enable_gpl_third_parties=yes enable_zrtp=yes enable_opus=yes enable_debug=no enable_ffmpeg=yes enable_tunnel=no all \
&& make -f builder-iphone-os.mk host=armv7s-apple-darwin enable_gpl_third_parties=yes enable_zrtp=yes enable_opus=yes enable_debug=no enable_ffmpeg=yes enable_tunnel=no all
mkdir -p /Users/jeffreywear/Dropbox/Development/linphone-iphone/submodules/build/..//../liblinphone-sdk/i386-apple-darwin/include
mkdir -p /Users/jeffreywear/Dropbox/Development/linphone-iphone/submodules/build/..//../liblinphone-sdk/i386-apple-darwin/lib/pkgconfig
mkdir -p /Users/jeffreywear/Dropbox/Development/linphone-iphone/submodules/build/../build-i386-apple-darwin/externals/polarssl
cd /Users/jeffreywear/Dropbox/Development/linphone-i
@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