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
zhuLiDoTheThing(args) | |
// Application status codes can come from HTTP 2xx, 4xx, and 5xx responses. This `.then()` will attempt to resolve | |
// to Promise<codeString> or reject with an error if the code is missing from the response body. | |
.then( | |
response => { | |
if (response.code) { | |
// Forward the code from the response | |
return response.code; | |
} | |
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
sub, sup { | |
/* Specified in % so that the sup/sup is the | |
right size relative to the surrounding text */ | |
font-size: 75%; | |
/* Zero out the line-height so that it doesn't | |
interfere with the positioning that follows */ | |
line-height: 0; | |
/* Where the magic happens: makes all browsers position |
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
// Option 1 | |
let var1, var2, var3; | |
if (someCondition) { | |
var1 = 'value1'; | |
var2 = 'value2'; | |
var3 = 'value3'; | |
} else { | |
var1 = "other1"; | |
var2 = "other2"; | |
var3 = "other3"; |
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 { useState, useRef } from 'react'; | |
// Can't use React State because setting the constant to a function will execute that function in `useState` | |
// const useConstant = value => useState(value)[0]; | |
const useConstant = value => useRef(value).current; | |
const myConst = useConstant('foo'); |
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
//// POST INTERVIEW VERSION | |
// NOTE Rado, Yi: I took the code where I left off and got it working in this second Gist file. It's probably not | |
// the most elegant solution, but it works. The code as of the end of the interview is in the other Gist. | |
// Given a binary tree, how would you serialize it into a string? | |
//Example input | |
var input = { | |
value: "a", | |
left: { |
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
// START: DENO STD colors | |
// https://jsr.io/@std/fmt/doc | |
/** | |
* Builds color code | |
* @param open | |
* @param close | |
*/ | |
const code = (open, close) => ({ | |
open: `\x1b[${open.join(';')}m`, | |
close: `\x1b[${close}m`, |
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 prop = key => obj => obj[key]; | |
// Action Types | |
const MY_ACTION = '{my}-app/{module}/MY_ACTION'; | |
// Action Creators | |
export const myAction = (value) => ({ | |
type: MY_ACTION, | |
payload: value, | |
}); |
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
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>a11y for HTML</title> | |
<style> | |
/** | |
* Visually hide an element, but leave it available for screen readers | |
* @link https://github.com/h5bp/html5-boilerplate/blob/master/dist/css/main.css | |
* @link http://snook.ca/archives/html_and_css/hiding-content-for-accessibility |
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
{ | |
"name": "simple-model", | |
"version": "1.0.0", | |
"main": "index.js", | |
"license": "MIT", | |
"dependencies": {}, | |
"scripts": { | |
"start": "watch 'yarn run test' src", | |
"test": "tape -r esm src/*.test.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
const builtInErrorTypes = [ | |
Error, | |
EvalError, | |
RangeError, | |
ReferenceError, | |
SyntaxError, | |
TypeError, | |
URIError, | |
]; |