| Operation | Logic | Python Code Implementation |
|---|---|---|
| Diagonal Flip (Transpose) | Swap row/col across the main diagonal. | for i in range(n):`` for j in range(i + 1, n):`` matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j] |
This file contains hidden or 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
| #!/bin/bash | |
| # This script archive 2 things here | |
| # 1. boot the fresh simulator once, so we can reduce the boot time in UI test | |
| # 2. Simulator shows swipe tutorial on first use of keyboard (iOS13 above), this script will set simulator preferences so it wont show the tutorial | |
| function get_simulator_udid() { | |
| echo '' | xcrun simctl list devices | grep "iPhone" | grep -v "unavailable" | awk -F "[()]" '{ for (i=2; i<NF; i+=2) print $i }' | grep '^[-A-Z0-9]*$' | |
| } |
This file contains hidden or 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
| 2020-03-03 15:49:44.579009-0800 WebDriverAgentRunner-Runner[13001:2373474] The following attributes were requested to be included into the XML: {( | |
| FBEnabledAttribute, | |
| FBVisibleAttribute, | |
| FBXAttribute, | |
| FBYAttribute, | |
| FBWidthAttribute, | |
| FBHeightAttribute, | |
| FBTypeAttribute, | |
| FBValueAttribute, | |
| FBNameAttribute, |
This file contains hidden or 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
| # Redirect console output to a file and display on console at the same time. | |
| bundle exec fastlane <your_lane_here> --verbose 2>&1 | tee /path/to/logfile.txt |
This file contains hidden or 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
| # Install snapshot gem | |
| gem install snapshot | |
| # Reset all the simulators | |
| fastlane snapshot reset_simulators |
This file contains hidden or 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
| # to list the sessions and their status | |
| screen -ls | |
| # to start a session with a given name. The name should be unique | |
| screen -S session_name | |
| # to start a session without going into it | |
| screen -dmS session_name /path/to/script/file.sh |
This file contains hidden or 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
| erase_sim: | |
| ./reset_sim.sh 2>/dev/null; true |
This file contains hidden or 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
| // Copied from https://stackoverflow.com/a/49944637 | |
| import XCTest | |
| enum TestSwipeDirections { | |
| case up | |
| case down | |
| case left | |
| case right | |
| } |
This file contains hidden or 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
| extension XCUIApplication { | |
| private struct Constants { | |
| // Half way accross the screen and 10% from top | |
| static let topOffset = CGVector(dx: 0.5, dy: 0.1) | |
| // Half way accross the screen and 90% from top | |
| static let bottomOffset = CGVector(dx: 0.5, dy: 0.9) | |
| } | |
| var screenTopCoordinate: XCUICoordinate { |
With JQ installed - output of this command is string with quotes
xcrun simctl list --json | jq '.devices["iOS 12.0"] [] | select(.name=="iPhone X") | .udid'
With JQ if you don't want quotes
NewerOlder