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 allocateMemory(size) { | |
// Simulate allocation of bytes | |
const numbers = size / 8; | |
const arr = []; | |
arr.length = numbers; | |
for (let i = 0; i < numbers; i++) { | |
arr[i] = i; | |
} | |
return arr; | |
} |
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
# Get a personal access token from github and enable SSO for it. | |
# Change in to the directory containing your repos | |
# cd /path/to/your/repo/dir | |
# git clone https://gist.github.com/crmitchelmore/72888315549fe33119a60e739e6ff5da | |
# mv 72888315549fe33119a60e739e6ff5da/update-origins.sh . | |
# rm -rf 72888315549fe33119a60e739e6ff5da | |
# chmod +x update-origins.sh | |
# GH_PAT=PASTyourPAThere ./update-origins.sh | |
# Wait :) |
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
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]) |
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
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: |
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
# -*- 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." |
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
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 |
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
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, |
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
[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 |
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
#import "UIBarButtonItem+BPAccessibilityIdentifier.h" | |
#import <objc/runtime.h> | |
@implementation UIBarButtonItem (BPAccessibilityIdentifier) | |
static void * BPBarButtonAccessibilityIdentifier = &BPBarButtonAccessibilityIdentifier; | |