Skip to content

Instantly share code, notes, and snippets.

@nathankrishnan
nathankrishnan / Yelp Android - View Hierarchy XML
Created October 28, 2021 08:31
Yelp Android - View Hierarchy XML
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<hierarchy index="0" class="hierarchy" rotation="0" width="1080" height="2176">
<android.widget.FrameLayout index="0" package="com.yelp.android" class="android.widget.FrameLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][1080,2176]" displayed="true">
<android.widget.LinearLayout index="0" package="com.yelp.android" class="android.widget.LinearLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][1080,2176]" displayed="true">
<android.widget.FrameLayout index="0" package="com.yelp.android" class="android.widget.FrameLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickab
@nathankrishnan
nathankrishnan / Apple Maps - View Hierarchy.xml
Last active October 28, 2021 07:51
Apple Maps - View Hierarchy XML
<?xml version="1.0" encoding="UTF-8"?>
<XCUIElementTypeApplication type="XCUIElementTypeApplication" name=" " label=" " enabled="true" visible="true" accessible="false" x="0" y="0" width="390" height="844" index="0">
<XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="false" accessible="false" x="0" y="0" width="390" height="844" index="0">
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" accessible="false" x="0" y="0" width="390" height="844" index="0">
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" accessible="false" x="0" y="0" width="390" height="844" index="0">
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" accessible="false" x="0" y="0" width="390" height="844" index="0">
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" accessible="false" x="0" y="0" width="390" height="844" index="0"/></XCUIElementTypeOther>
</XCUIElementTypeOther>
@nathankrishnan
nathankrishnan / Google Assistant - View Hierarchy.xml
Created October 28, 2021 06:23
Google Assistant - View Hierarchy XML
<?xml version=\'1.0\' encoding=\'UTF-8\' standalone=\'yes\' ?>\r\n
<hierarchy index="0" class="hierarchy" rotation="0" width="1080" height="2176">\r\n
<android.widget.FrameLayout index="0" package="com.google.android.googlequicksearchbox" class="android.widget.FrameLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][1080,2176]" displayed="true">\r\n
<android.widget.LinearLayout index="0" package="com.google.android.googlequicksearchbox" class="android.widget.LinearLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,0][1080,2176]" displayed="true">\r\n
<android.widget.FrameLayout index="0" package="com.google.android.googlequicksearchbox" class="android.widget.FrameLayout" text="" checkable=
@nathankrishnan
nathankrishnan / Appium - Common Element Actions.csv
Created September 21, 2021 07:26
Appium - Common Element Actions
Action Description
Click Tap on an element.
Send Keys Send keyboard input text into a text field element.
Clear Clear the text in a text field element.
@nathankrishnan
nathankrishnan / Appium - Common Locator Strategies.csv
Last active February 10, 2023 12:38
Appium - Common Locator Strategies
Locator Strategy Description
Id Finds an element by the id attribute on iOS and resource-id attribute on Android.
Accessibility ID Finds an element by the accessibility-id attribute on iOS and the content-desc attribute on Android
Class Name Finds an element by its XCUIElementType on iOS and by the widget name on Android. For example, a button class would be XCUIElementTypeButton in iOS and android.widget.Button in Android.
XPath Finds an element by its position in the XML representation of the View Hierarchy.
Android UiSelector An Android-specific strategy for finding an element using Android’s UiSelector API.
iOS Predicate String An iOS-specific strategy for finding an element using iOS's Predicate Format String Syntax.
@nathankrishnan
nathankrishnan / uuid_user.py
Created January 28, 2021 07:12 — forked from gmolveau/uuid_user.py
sqlalchemy uuid for sqlite
########################
# UUID for SQLite hack #
########################
from sqlalchemy.types import TypeDecorator, CHAR
from sqlalchemy.dialects.postgresql import UUID
import uuid
class GUID(TypeDecorator):
let badDomains = BloomFilter<String>(size: 1024, hashFunctions: [djb2, sdbm])
badDomains.insert("badguys.com")
badDomains.insert("drevil.me")
badDomains.insert("virus.io")
let websiteToLoad = NSURL(string: "http://virus.io")
if let validDomain = websiteToLoad?.host {
if badDomains.query(validDomain) {
print("The website is most likely bad!")
} else {
public func isEmpty() -> Bool {
return array.reduce(true) { prev, next in prev && !next }
}
public func query(_ value: T) -> Bool {
let hashValuePositions = computeHashes(value)
let valuesAtIndices = hashValuePositions.map() { hashValuePosition in array[hashValuePosition] }
let exists = valuesAtIndices.reduce(true, { $0 && $1 })
return exists
}
public func insert(_ element: T) {
for hashValuePosition in computeHashes(element) {
array[hashValuePosition] = true
}
}