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
| const sign_in = async ({ username, password }) => { | |
| await driver.get(constants.TRADE_ME_AUTH_URL); | |
| return new Promise((resolve, reject) => { | |
| setTimeout(async () => { | |
| try { | |
| await driver | |
| .findElement(selenium.By.id(constants.view.emailInputElementId)) | |
| .sendKeys(username); | |
| await driver | |
| .findElement(selenium.By.id(constants.view.passwordInputElementId)) |
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
| let Node = function(n) { | |
| this.name = n; | |
| this.edges = [] | |
| } | |
| function calcCombinations(node, length) { | |
| let currentPath = []; | |
| let combinations = []; |
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
| import React from "react"; | |
| import ReactDOM from "react-dom"; | |
| import { useState, useEffect, useRef } from "react"; | |
| import posed, { PoseGroup } from "react-pose"; | |
| import "./styles.css"; | |
| let AnimatableDiv = posed.div({ | |
| enter: { | |
| y: 0, | |
| x: 0, |
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
| import React from "react"; | |
| import ReactDOM from "react-dom"; | |
| import { | |
| useEffect, | |
| useState, | |
| useRef, | |
| useReducer, | |
| useContext, | |
| useCallback, | |
| useMemo, |
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
| const util = require("util"); | |
| function doSomethingAsync(count, callback) { | |
| setTimeout(function() { | |
| callback(null,'hi'); | |
| }, 0); | |
| } | |
| function asyncCallback(asyncFunc, ...args) { | |
| return util.promisify(asyncFunc)(...args); |
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
| const getElementInfo = (domElement, obj = {}) => { | |
| const toNumber = (thing) => { | |
| //console.log('converting ' + thing + ' to ' + Number(thing.replace(/[^0-9]+/,''))); | |
| return Number(thing.replace(/[^0-9]+/, '')); | |
| } | |
| //Our offset from our parent, could be the first positioned parent element or the document body | |
| const parentOffsetTop = domElement.offsetTop; | |
| const parentOffsetLeft = domElement.offsetLeft; |
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
| function rgba2hex(orig) { | |
| var a, isPercent, | |
| rgb = orig.replace(/\s/g, '').match(/^rgba?\((\d+),(\d+),(\d+),?([^,\s)]+)?/i), | |
| alpha = (rgb && rgb[4] || "").trim(), | |
| hex = rgb ? | |
| (rgb[1] | 1 << 8).toString(16).slice(1) + | |
| (rgb[2] | 1 << 8).toString(16).slice(1) + | |
| (rgb[3] | 1 << 8).toString(16).slice(1) : orig; |
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
| const getElementInfo = (domElement, obj = {}) => { | |
| const toNumber = (thing) => { | |
| //console.log('converting ' + thing + ' to ' + Number(thing.replace(/[^0-9]+/,''))); | |
| return Number(thing.replace(/[^0-9]+/, '')); | |
| } | |
| //Our offset from our parent, could be the first positioned parent element or the document body | |
| const parentOffsetTop = domElement.offsetTop; | |
| const parentOffsetLeft = domElement.offsetLeft; |
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
| import { createStore } from 'redux' | |
| /* | |
| Define the async reducer | |
| */ | |
| const arrayAppend = async (state, action) => { | |
| return [...state, action.toAdd]; | |
| } |
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
| const scriptArgs = process.argv.slice(2) | |
| const [typeName, schemaName] = scriptArgs; | |
| const Schema = require(`../database/models/${schemaName}`); | |
| const getType = (key, value) => { | |
| const formatKey = (key) => { | |
| let formatted = `${key[0].toUpperCase() + key.substring(1)}`; | |
| formatted = formatted.endsWith('s') ? formatted.slice(0, -1) : formatted; |