Skip to content

Instantly share code, notes, and snippets.

Chris Mitchelmore crmitchelmore

Block or report user

Report or block crmitchelmore

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@crmitchelmore
crmitchelmore / model_splliter.swift
Last active Nov 17, 2017
Split model structs, enum, classes, extensions from 1 file to 1 per type. Types should be codable or regex will need changing
View model_splliter.swift
import Foundation
import PlaygroundSupport
let documentsDir = PlaygroundSupport.playgroundSharedDataDirectory
let fileManager = FileManager()
extension String {
subscript (bounds: CountableClosedRange<Int>) -> String {
let start = index(startIndex, offsetBy: bounds.lowerBound)
let end = index(startIndex, offsetBy: bounds.upperBound)
return String(self[start...end])
@crmitchelmore
crmitchelmore / ArrayExtension
Last active May 20, 2016
Converting strings in to arrays
View ArrayExtension
import Foundation
extension Array: StringLiteralConvertible {
init(string: String) {
self.init()
appendContentsOf(string.componentsSeparatedByString(",").flatMap {
switch Element.self {
case is Int.Type:
return Int($0) as? Element
case is Double.Type, is Float.Type:
View gist:8518655
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "calabash-cucumber"
s.version = "0.9.165"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Karl Krukow"]
s.date = "2014-01-20"
s.description = "calabash-cucumber drives tests for native iOS apps. You must link your app with calabash-ios-server framework to execute tests."
View gist:8436074
irb(main):002:0> keyboard_enter_text "\b"
Sending UIA command
uia.typeString(', '0.11')
Result
{"status"=>"error", "value"=>"VerboseError: Unable to type: \b", "backtrace"=>"fail__delegate@file:///Users/cmitchelmore/work/barpass/barpass-iphone-v2/8709A6E6-9D19-4F5B-83BE-F7FAB62B16D9/calabash_script_uia.js:20854:28\nfail@file:///Users/cmitchelmore/work/barpass/barpass-iphone-v2/8709A6E6-9D19-4F5B-83BE-F7FAB62B16D9/calabash_script_uia.js:20861:31\nfile:///Users/cmitchelmore/work/barpass/barpass-iphone-v2/8709A6E6-9D19-4F5B-83BE-F7FAB62B16D9/calabash_script_uia.js:21352:38\nfile:///Users/cmitchelmore/work/barpass/barpass-iphone-v2/8709A6E6-9D19-4F5B-83BE-F7FAB62B16D9/calabash_script_uia.js:11579:38\nlazy_seq_value@file:///Users/cmitchelmore/work/barpass/barpass-iphone-v2/8709A6E6-9D19-4F5B-83BE-F7FAB62B16D9/calabash_script_uia.js:8173:24\ncljs$core$ISeq$_first$arity$1@file:///Users/cmitchelmore/work/barpass/barpass-iphone-v2/8709A6E6-9D19-4F5B-83BE-F7FAB62B16D9/calabash_script_uia.js:8224:66\n_first@file:///User
View gist:8434227
irb(main):006:0> query("tableViewCell descendant view {text LIKE 'Stella Artois Bottle '}")
[
[0] {
"class" => "BPLabel",
"id" => nil,
"rect" => {
"center_x" => 178,
"y" => 80,
"width" => 244,
"x" => 56,
View gist:8434163
[10:38:57]chrismbp barpass-iphone-v2/ [calabash2]$ DEBUG=1 CALABASH_FULL_CONSOLE_OUTPUT=1 calabash-ios console
Running irb...
irb(main):001:0> start_test_server_in_background
......
irb(main):002:0> query("tableViewCell {text LIKE 'Stella Artois Bottle '}")
[]
irb(main):003:0> swipe("left", {:query => "tableViewCell {text LIKE 'Stella Artois Bottle '"})
Sending UIA command
uia.swipeOffset('{:x 160, :y 97}', '{:query "tableViewCell {text LIKE \'Stella Artois Bottle \'", :direction :left}')
Result
View gist:8357164
#import "UIBarButtonItem+BPAccessibilityIdentifier.h"
#import <objc/runtime.h>
@implementation UIBarButtonItem (BPAccessibilityIdentifier)
static void * BPBarButtonAccessibilityIdentifier = &BPBarButtonAccessibilityIdentifier;
You can’t perform that action at this time.