I hereby claim:
- I am jchiatt on github.
- I am jchiatt (https://keybase.io/jchiatt) on keybase.
- I have a public key ASA_XIgo0LuccMWWhR8IfdNwzddKGteceOZ8MvLj2wrHAwo
To claim this, I am signing this object:
const IMAGE_EXTENSIONS = [".jpg", ".png", ".svg", ".webp", ".gif"] | |
const getFileExtension = url => `.${url.split('?')[0].split('.').pop()}` | |
const imageUrls = | |
Array.from( | |
document.querySelectorAll('img') | |
).map(({ src }) => ({src})) | |
.filter(({ src }) => { | |
return src && IMAGE_EXTENSIONS.includes(getFileExtension(src)) | |
}) | |
.map(({src}, idx) => ({ src, filename: `Image-${idx}${getFileExtension(src)}`})) |
function findClosestValueInBst(tree, target) { | |
return findClosestValueRecursive(tree, target, tree.value); | |
} | |
function findClosestValueRecursive(tree, target, closest) { | |
if (!tree) return closest; | |
if (Math.abs(target - closest) > Math.abs(target - tree.value)) { | |
closest = tree.value; | |
} | |
if (target < tree.value) { |
/** | |
Given two non-empty arrays of integers, write a function that determines whether the second array is a subsequence of the first one. | |
A subsequence of an array is a set of numbers that aren't necessarily adjacent in the array but that are in the same order as they appear in the array. | |
For instance, the numbers [1, 3, 4 form a subsequence of the array [1, 2, 3, 4] and so do the numbers [2, 4]. | |
Note that a single number in an array and the array itself are both valid subsequences of the array. | |
*Sample Input* | |
array = [5, 1, 22, 25, 6, -1, 8, 10]` | |
sequence = [1, 6, -1, 10] |
function twoNumberSum(array, targetSum) { | |
if ( !Array.isArray(array) || !array.length ) throw new Error('You must provide an array of values.'); | |
const result = []; | |
const numberMap = {}; | |
for ( let i = 0; i < array.length; i++ ) { | |
const diff = targetSum - array[i]; | |
console.log(diff) | |
if ( numberMap[diff] ) { | |
result.push(array[i], diff); |
const root = { | |
"id": 0, | |
"children": [ | |
{ | |
"id": 1, | |
"children": [ | |
{ | |
"id": 3, | |
"children": [ | |
{ |
const root = { | |
"id": 0, | |
"children": [ | |
{ | |
"id": 1, | |
"children": [ | |
{ | |
"id": 3, | |
"children": [ | |
{ |
I hereby claim:
To claim this, I am signing this object:
/* tslint:disable:only-arrow-functions no-unsafe-any */ | |
import { WrappedFunction } from '@sentry/types'; | |
import { isInstanceOf, isString } from './is'; | |
import { logger } from './logger'; | |
import { getFunctionName, getGlobalObject } from './misc'; | |
import { fill } from './object'; | |
import { supportsHistory, supportsNativeFetch } from './supports'; |
package main | |
import ( | |
"encoding/json" | |
"log" | |
"net/http" | |
"github.com/gorilla/mux" | |
) |
package main | |
import ( | |
"encoding/json" | |
"log" | |
"net/http" | |
"github.com/gorilla/mux" | |
) |