Skip to content

Instantly share code, notes, and snippets.

View brizandrew's full-sized avatar

Andrew Briz brizandrew

View GitHub Profile
"""
@function isNumber
Utility function to determine if a string is a valid number
@param {str} string: The string to test
@return {boolean}: Whether or not it's a valid number
"""
def isNumber(string):
try:
float(string)
return True
"""
@function indexOfAll
Utility function to find the index of every instance of a given substring in a string
@param {str} string: The string to search through
@param {str} sub: The substring to search for
@return {int[]}: A list of indeces everywhere that substring appears
"""
def indexOfAll(string, sub):
output = []
for i in range(0,len(string)):
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
"""
@function elementExists
Checks if a given element exists on the driver page given a search type and value
@param {WebDriver} driver: The driver to search for
@param {str} locateType: The type of search to preform (only "by_id" is supported)
@param {str} locateValue: The value of a given type to search for (only "id" is supported)
@return {boolean}: Whether or not it exists
var vid = new Hypervideo({
path: "SxccCYudkxg", // YouTube video Id or path to self hosted video
host: "YouTube", // Either "YouTube" or "Self" for self hosted videos
aspectRatio: "16:9", // Aspect Ratio of either "16:9" or "4:3"
list: [ // 2D array of line items and times they appear
["JC Jackson Arrested",9],
["Young Body Found",114],
["Local Weather",166],
["Summer Burglary Prevention",246],
["Florida Abortion Bill",296],
import yagmail
import dbInfo
yag = yagmail.SMTP(dbInfo.alertEmail)
# Password for <email-username>: Type password here
# Save username and password in keyring? [y/n]: Type 'y'