I hereby claim:
- I am casschin on github.
- I am cass (https://keybase.io/cass) on keybase.
- I have a public key whose fingerprint is BD4F C251 781F 90F5 9630 0489 36F5 8E7E EE99 9AF5
To claim this, I am signing this object:
function poll({ fn, validate, interval = 1000, maxAttempts = 100 }) { | |
let attempts = 0; | |
let stop = false; | |
async function execute(resolve, reject) { | |
const res = await fn(); | |
attempts += 1; | |
if (validate(res)) { | |
resolve(res); | |
} else if (maxAttempts === attempts) { | |
return reject("Hit max poll attempts"); |
// function that will allow you to move an item within a list and will reposition the other items accordingly | |
type ListItem = { | |
label: string; | |
pos: number; | |
} | |
const list = [ | |
{ | |
label: "a", |
// Stolen from: https://revs.runtime-revolution.com/getting-100-with-rounded-percentages-273ffa70252b | |
export const processDatasetWithAdjustedPercentages = dataset => { | |
// get the total count to caluclate the actual percentage | |
const totalCount = dataset.reduce((acc, data) => acc + data.value, 0); | |
// map the dataset and add properties for the percentage values we'll need | |
const datasetWithPercentages = dataset.map(data => { | |
const rawPercentage = (data.value / totalCount) * 100; // ex: 43.234235235 | |
const floorPercentage = Math.floor(rawPercentage); // ex: 43 |
function logFirst() { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => resolve(console.log("first")), 300); | |
}); | |
} | |
function logSecond() { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => resolve(console.log("second")), 100); | |
}); | |
} |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env python | |
# This Source Code Form is subject to the terms of the Mozilla Public | |
# License, v. 2.0. If a copy of the MPL was not distributed with this | |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
from selenium.webdriver.common.by import By | |
from pages.desktop.base import Base | |
class MozillaBasedPage(Base): |
### Locating UI elements ### | |
# By ID | |
<div id="coolestWidgetEvah">...</div> | |
element = driver.find_element_by_id("coolestWidgetEvah") | |
or | |
from selenium.webdriver.common.by import By | |
element = driver.find_element(by=By.ID, value="coolestWidgetEvah") | |
# By class name: |