Skip to content

Instantly share code, notes, and snippets.


cheddar chadwithuhc

View GitHub Profile
chadwithuhc / switch-or-object-map.js
Created Jul 8, 2021
switch statement vs object lookup
View switch-or-object-map.js
// 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":
View Coding Garden Chat

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: - Ex: !team vuejs
!flag [country-code] Set the flag of your country in live chat. country list: Ex: !flag us, !flag usa, !flag Germany
!setstatus [message] Sets your status message in live chat window
chadwithuhc /
Created Jun 22, 2018
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 /
Last active Nov 1, 2019
Code Katas I enjoyed solving
View dom-selection-manipulation.js
// Refactor to use `querySelector()` instead
document.getElementsByClassName("message")[0].innerHTML = 'Hello World'
// Solution
// `querySelector()` will select the first item it finds
// ---


  • 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?


View url-params.js
// 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 / build-a-diamond.txt
Last active Jun 29, 2018
Whiteboarding Questions
View build-a-diamond.txt
Build the following triangle in code
* *
* * *
* * * *
* * * * *
We could call it with `printTriangle(5)` where `5` is the number of rows to make
chadwithuhc / declaring-values-in-function.js
Last active Feb 7, 2018
React Refactors for Clean Code
View declaring-values-in-function.js
// Challenge: Refactor the `render()` method with declare all variables at top
render() {
return (
<div className="profile-card">
<header className="profile-header" onClick={this.toggleClass}>
<img src={this.props.profile.image} alt={} />
chadwithuhc / index.html
Created Nov 10, 2017
DOM Events Sample
View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
nav {background: tomato}