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
var script = document.createElement('script'); | |
script.src = "https://code.jquery.com/jquery-latest.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(script); |
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 {equals, flatten, join, map, pipe, unnest, xprod} = require('ramda'); | |
const xprod2 = require('./xprod.js'); | |
const urls = [ | |
'stackexchange.com', | |
'askubuntu.com', | |
'superuser.com' | |
]; | |
const filters = [ |
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
Show hidden characters
{ | |
"include": ["./node_modules/cypress", "cypress/**/*.js"] | |
} |
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
export const immutableSort = <T>(array: T[], comparatorFn?: (a: T, b: T) => number): T[] => | |
[...array].sort(comparatorFn); | |
describe('immutableSort', () => { | |
const testData = [4, 2, 5, -1, 0]; | |
it('can sort an array', () => { | |
const result = immutableSort(testData); | |
expect(result).toStrictEqual([-1, 0, 2, 4, 5]); | |
}); |
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
/** | |
* Creates a sort function that will compare based upon a certain property in an object. | |
* | |
* @param {keyof T} prop - the property of the object to sort by | |
* @param [options.order] the order to sort - either 'asc' or 'desc' | |
* @param [options.callback] callback used as a tiebreaker when the property on both objects is equal. | |
* @returns A function to be passed to Array.sort(); | |
*/ | |
export const numericPropSort = | |
<P extends string, T extends Record<P | keyof T, number>>( |
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
#! /usr/bin/env bash | |
find ./src/bookmarklets -name "*.js" -print0 | xargs -I FILE -0 -P "$(nproc)" npm run rollup -- --input "FILE" --file "output/FILE" | |
# EDIT: Per my latest comment - I now prefer this: | |
for bookmarklet in ./src/bookmarklets/**/*.js | |
do | |
npm run rollup -- --input "$bookmarklet" --file "output/$bookmarklet" & | |
done | |
wait |
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 keymap = <T extends unknown, U extends object>( | |
object: U, | |
callback: (key: keyof U, index: number) => T | |
) => (Object.keys(object) as (keyof U)[]).map(callback); |
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
step('Trigger NewRelic marker', async (b: Browser) => { | |
const description = `Flood run started - ${ENV.FLOOD_SEQUENCE_ID}`; | |
await b.page.evaluate( | |
(_description, sequenceId) => { | |
const applicationId = '123'; | |
fetch(`https://api.newrelic.com/v2/applications/${applicationId}/deployments.json`, { | |
method: 'POST', | |
body: JSON.stringify({ | |
deployment: { | |
description: _description, |
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 container = $('#files'); | |
const files = Array.from($$('.file')); | |
const getSortText = (el) => el.querySelector('.diffstat').innerText; | |
files.sort((a, b) => { | |
const aSortText = getSortText(a); | |
const bSortText = getSortText(b); | |
if (aSortText > bSortText) return 1; | |
if (aSortText < bSortText) return -1; | |
return 0; | |
}); |
NewerOlder