Skip to content

Instantly share code, notes, and snippets.

View alanbsmith's full-sized avatar
👋

Alan B Smith alanbsmith

👋
View GitHub Profile
@alanbsmith
alanbsmith / us-cities.json
Created February 22, 2024 21:23
Mock US CIty Data
This file has been truncated, but you can view the full file.
[
{
"city": "New York",
"cityAscii": "New York",
"stateId": "NY",
"stateName": "New York",
"countyFips": "36081",
"countyName": "Queens",
"lat": "40.6943",
@alanbsmith
alanbsmith / Data Visualization Resources.md
Last active March 4, 2023 18:33
A WIP of helpful data go resources as I find them
Date V8 V7 V6 V5 V4
2022-05-24 0 3 71 12 25
2022-07-12 0 25 44 10 23
2022-07-25 0 31 41 9 21
2022-08-25 0 50 30 9 19
2022-10-19 0 65 17 6 15
2022-11-01 0 68 15 6 16
2022-12-15 18 59 8 5 13
2023-01-10 22 51 7 5 12
@alanbsmith
alanbsmith / styling-thoughts.md
Created October 19, 2022 23:14
Some brief styling thoughts

On CSS-in-JS

Overview

This is not an argument for or against any particular library or solution for styling UI. Instead I’d like to bring a bit of context and nuance to the conversation in a way that doesn’t add to the ongoing flame war.

First-Gen CSS-in-JS Wins

There are some things Emotion and Styled Components do very well, especially considering the styling landscape when they was created.

Cupcakes 🧁

Yield

24 cupcakes

Ingredients

Batter

@alanbsmith
alanbsmith / uncheck-twitter-interests.md
Created March 25, 2022 16:55
Uncheck all Twitter interests
@alanbsmith
alanbsmith / guard-and-callback-example.jsx
Created December 14, 2021 04:09
Simplified guard and callback example
const MyToggleButton = ({ isContentReady, {...props} }) => {
const modelConfig = {
isIntiallyToggled: true,
shouldToggle: (data, state) => {
if (!iContentReady) {
return false;
}
return true;
},
onToggle: (data, prevState) => {
@alanbsmith
alanbsmith / function-iterator.md
Created December 14, 2021 02:35
function iterator
function eventHandler(...fns) {
  return (e) => {
    fns.forEach(fn => fn(e);
  }
}

function Component({ onClick )) {
  const handler = useClickable();
 
// generate a random answer for a given range
function setAnswer(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
// find the midpoint for a given range
function getRangeMidpoint(min, max) {
const count = min + max - 1;
return Math.ceil(count/2);
}
@alanbsmith
alanbsmith / Cocktail Starter List.md
Created November 17, 2021 20:38
A cocktail starter list and things to have on-hand for making drinks at home

Cocktail Starter List

Below are lists of simple cocktails to make at home that often share the same ingredients. If you're getting started, this is a great list to get some classic cocktails under your belt and practice your technique.

Great Starter Cocktails

Gin

  • Gin & Tonic - gin / tonic / fresh lime or lemon
  • Gimlet - gin / simple syrup / fresh lime