Skip to content

Instantly share code, notes, and snippets.

View TimB0's full-sized avatar

Timothy Boland TimB0

  • Valencia, Ca.
  • 23:41 (UTC -12:00)
View GitHub Profile
@TimB0
TimB0 / Regular_Expression_Examples
Last active May 18, 2022 23:35
Regular Expression Examples
Regular Expressions - Enough to be Dangerous
https://www.youtube.com/watch?v=bgBWp9EIlMM&t=163s
Engineer Man
Engnineer Man|Super Man
(Engineer|Super) Man
1234
^12$
^1234$
^[123456]$
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
// ============================================================ //
// CAST
// ============================================================ //
window.chrome = {};
window.chrome.cast = {};
window.chrome.cast.isAvailable = true;
window.chrome.cast.initialize = function(a, b, c) { }
window.chrome.cast.ApiConfig = function(a, b, c) {
// This fakes that chromecast is available so the button appears
// call anything other than "available" to fake chromcast dissapearing
package example.junit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
@TimB0
TimB0 / AutomateTImesSquareCalendar.java
Created August 8, 2016 17:15
A UiAutomator Example for automating the Times Square calendar as it is used in the Hilton Hhonors app.
package tests;
import android.os.Build;
import com.android.uiautomator.core.UiCollection;
import com.android.uiautomator.core.UiObject;
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.core.UiScrollable;
import com.android.uiautomator.core.UiSelector;
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
if(isKeyboardDisplayed()) {
System.out.println("Close Keyboard");
getUiDevice().pressBack();
}
@TimB0
TimB0 / isKeyboardDisplayed.java
Created May 29, 2016 21:41
A Java function to use in a UiAutomator test to find out whether the Android keyboard is open or not
public boolean isKeyboardDisplayed() {
String checkKeyboardCommand = "dumpsys input_method | grep mInputShown";
try {
Process process = Runtime.getRuntime().exec(checkKeyboardCommand);
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
int read;
char[] buffer = new char[4096];
StringBuffer output = new StringBuffer();
while ((read = reader.read(buffer)) > 0) {
output.append(buffer, 0, read);
@TimB0
TimB0 / android.md
Last active August 29, 2015 14:21 — forked from geekygecko/android.md

Android Cheat Sheet

Developer tips

Record a video of your app

Developer options -> Check show touches
adb shell screenrecord /sdcard/video.mp4
adb pull /sdcard/video.mp4