Skip to content

Instantly share code, notes, and snippets.

View ifyoumakeit's full-sized avatar
:octocat:
Githubbin’

Dave Garwacke ifyoumakeit

:octocat:
Githubbin’
View GitHub Profile
const USER_TYPE = {
new_customer_hto: "new_customer_hto",
new_customer_rx_retail: "new_customer_rx_retail",
new_customer_rx: "new_customer_rx",
returning_customer_hto: "returning_customer_hto",
returning_customer_saved_expired_rx: "returning_customer_saved_expired_rx",
returning_customer_saved: "returning_customer_saved",
returning_customer_saved_expired_payment:
"returning_customer_saved_expired_payment",
returning_customer_saved_expired_rx_payment:
@ifyoumakeit
ifyoumakeit / machine.js
Created August 25, 2020 21:04
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@ifyoumakeit
ifyoumakeit / github-conventional-comments.js
Last active March 21, 2024 14:52
GitHub Conventional Comments (instructions to install in comment below code)
(async function generateReplies(document) {
// https://conventionalcomments.org/#labels
const LABEL = {
praise: "praise",
nitpick: "nitpick",
suggestion: "suggestion",
issue: "issue",
todo: "todo",
question: "question",
thought: "thought",
@ifyoumakeit
ifyoumakeit / Reference.md
Last active April 21, 2020 11:27
Reference.md

alt replace alt

reference links

@ifyoumakeit
ifyoumakeit / machine.js
Last active February 17, 2020 00:54
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
Reach
Register
Login
processMobileNumber -> Is Returning User?
Is Returning User?
pass -> Search
fail -> Authentication
Authentication
processToken -> Is Token Valid?
Is Token Valid?
@ifyoumakeit
ifyoumakeit / templatejs.js
Last active March 19, 2018 17:23
Quick JS templating with string template literals
const resolveExpression = exp => {
const resolved = typeof exp === "function" ? exp() : exp;
return Array.isArray(resolved)
? resolved.join("")
: typeof resolved !== "undefined" ? resolved : "";
};
const html = (strings, ...exps) => {
return strings.reduce((acc, str, i) => {
return `${acc}${resolveExpression(exps[i - 1])}${str}`;
@ifyoumakeit
ifyoumakeit / _struct.js
Last active January 4, 2018 17:57
Sortable Data Access Structure
/**
* Sort or set keys
* @param data {object} Keyed data store
* @param keysOrSort {array|function}
* @return {array}
*/
const sortKeys = (data, keysOrSort) => {
return typeof keysOrSort === "undefined"
? Object.keys(data).sort()
: typeof keysOrSort === "function"
@ifyoumakeit
ifyoumakeit / compose.js
Created November 25, 2017 02:21
Transducers / Composing
/**
* Composes functions like c(f, g) === f(g(x)).
* @param {arguments} fns Multiple functions w/ map/reduce.
* @returns reducer seeded with identity function.
* @example compose(x => x + 2, x => x - 1)(5) // 6 (5 + 2 -1)
*/
const compose = (...fns) => {
return fns.reduce((acc, fn) => {
return (...args) => {
return acc(fn(...args));
@ifyoumakeit
ifyoumakeit / getter.js
Created October 26, 2017 18:16
Getter Example
const order = {
subtotal: 35,
tax: 0.6,
get total() { return this.subtotal * this.tax }
}
order.subtotal // 35
order.tax // 0.6
order.total // 21
order.subtotal = 36