Skip to content

Instantly share code, notes, and snippets.

View chadwithuhc's full-sized avatar

cheddar chadwithuhc

View GitHub Profile
{
"compilerOptions": {
"module": "commonjs",
"target": "ESNext",
"strict": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitOverride": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
@chadwithuhc
chadwithuhc / switch-or-object-map.js
Created July 8, 2021 22:41
switch statement vs object lookup
// Q: Which would you prefer to get a mapped value?
// with a `switch` statement
export function getHeaderValue(headerName: string): string {
switch (headerName) {
case "content-type":
return headers.contentType();
case "content-length":
return headers.contentLength();
case "content-md5":

Coding Garden Chat Commands

Live Stream / Live Chat

Command Description
!project !workingon A quick description or link to the current project or thing we are working on
!badges Describe all the badge options available in the live chat window
!team [name] Set your team badge using the name of a Font Awesome brand: https://fontawesome.com/cheatsheet/free/brands - Ex: !team vuejs
!flag [country-code] Set the flag of your country in live chat. country list: https://restcountries.eu/rest/v2/all Ex: !flag us, !flag usa, !flag Germany
!setstatus [message] Sets your status message in live chat window
@chadwithuhc
chadwithuhc / katas.md
Last active November 1, 2019 02:30
Code Katas I enjoyed solving
@chadwithuhc
chadwithuhc / build-a-diamond.txt
Last active June 29, 2018 21:11
Whiteboarding Questions
Build the following triangle in code
*
* *
* * *
* * * *
* * * * *
We could call it with `printTriangle(5)` where `5` is the number of rows to make
@chadwithuhc
chadwithuhc / xcode-ios-simulator-install.md
Created June 22, 2018 15:51
XCode and iOS Simulator install

XCode and iOS Simulator install instructions

  1. Install XCode
  2. Open XCode, go to Preferences > Components > download simulator of choice
  3. In Preferences > Locations > Command Line Tools ensure your XCode version is selected
@chadwithuhc
chadwithuhc / dom-selection-manipulation.js
Last active March 27, 2018 16:50
JavaScript Refactors
// Refactor to use `querySelector()` instead
document.getElementsByClassName("message")[0].innerHTML = 'Hello World'
// Solution
// `querySelector()` will select the first item it finds
document.querySelector(".message").innerHTML
// ---
@chadwithuhc
chadwithuhc / sample-tech-screen-questions.md
Created March 15, 2018 20:19
Sample Tech Screen Questions

CSS

  • What are CSS selectors?
  • What is the specificity of those selectors?
  • What is the difference between .class1.class2 and .class1 .class2 as a selector?
  • How do you center something in CSS?
  • How do floats work?
  • How do you get something to not display using CSS?

JS

@chadwithuhc
chadwithuhc / url-params.js
Created February 7, 2018 04:44
JavaScript Pro Tips
// Challenge: Pull out the "character" value from the following URL string
// http://localhost:3000/characters/new?character=Art+Vandelay
// Using the `URL()` API, we can pull out the search params without needing to regex, split, or other wonkery
const params = (new URL(url)).searchParams
params.get('character') // Art Vandelay
// `URL()` will also handle uri decoding -- urls with %20, +, etc.
@chadwithuhc
chadwithuhc / declaring-values-in-function.js
Last active February 7, 2018 00:05
React Refactors for Clean Code
// Challenge: Refactor the `render()` method with declare all variables at top
render() {
return (
<li>
<div className="profile-card">
<header className="profile-header" onClick={this.toggleClass}>
<img src={this.props.profile.image} alt={this.props.profile.name} />
<h2>{this.props.profile.name}</h2>
</header>