Skip to content

Instantly share code, notes, and snippets.

View adg29's full-sized avatar
📱

Alan Garcia adg29

📱
View GitHub Profile
@adg29
adg29 / AuthUserProvider.tsx
Created January 29, 2022 02:25
AuthUserProvider.tsx: Typescript woes
import { useReducer, useEffect } from "react";
import firebase from "firebase/compat/app";
import { User as FirebaseUser } from "firebase/auth";
import {
IAuthProvider,
mainReducer,
initialState,
AuthUserActionsTypes,
formatAuthUser,
authUserContext,
@adg29
adg29 / conditionalwrap.js
Created September 25, 2020 22:43 — forked from kitze/conditionalwrap.js
one-line React component for conditionally wrapping children
import React from 'react';
const ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children;
const Header = ({shouldLinkToHome}) => (
<div>
<ConditionalWrap
condition={shouldLinkToHome}
wrap={children => <a href="/">{children}</a>}
>
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="StravaGPX" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd" version="1.1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
<metadata>
<time>2020-09-01T22:39:17Z</time>
</metadata>
<trk>
<name>Two a day keeps the lethargy away - Evening Ride ☀️</name>
<type>1</type>
<trkseg>
<trkpt lat="40.6554810" lon="-73.9631390">
@adg29
adg29 / async-stack-traces.js
Created November 25, 2019 23:51
async stack traces node 10 vs 12
async function sleep(num) {
return new Promise((resolve) => {
setTimeout(resolve, num)
}
}
async function execute() {
await sleep(10)
await stepOne()
}
@adg29
adg29 / async-stack-traces.js
Created November 25, 2019 23:35
async stack traces node 10 vs 12
async function sleep(num) {
return new Promise((resolve) => {
setTimeout(resolve, num)
}
}
async function execute() {
await sleep(10)
await stepOne()
}
@adg29
adg29 / index.js
Last active November 25, 2019 19:08
unhandledRejection event on process object
process.on('unhandledRejection', (reason, promise) => {
console.log(`Unhandled rejection at ${promise}`)
console.log(`Message ${reason}`)
})
const willThrowErrors = async () => {
return new Promise(function shouldBeCaught(resolve, reject) {
reject(`I should be caught and handled with!`)
})
}
@adg29
adg29 / leads-api.json
Last active November 22, 2019 01:13
Leads Fixture JSON Generator
[
{
"id": 1,
"name": "Daniels",
"email": "[email protected]",
"message": "Sit anim amet minim aliqua sit aute cupidatat ea nisi tempor cupidatat velit nisi tempor."
},
{
"id": 2,
"name": "Hamilton",
@adg29
adg29 / references.md
Last active November 21, 2019 19:27
Django pagination + React
@adg29
adg29 / projects.js
Last active November 10, 2019 00:09
Portfolio adg29
export default [
{
client: "Puma",
name: "MBBQ Factory",
company: "KBSP",
description: "PUMA online custom shoe website, offering thousands of unique design combinations and user boutiques.",
collaborators: [{
link: "https://figurea.net/PUMA-Factory"
name: "figurea, Creative Direction & Design"
}]
@adg29
adg29 / git-commit-log-viz-eazybi.md
Last active November 5, 2019 18:59
Git Commit Log – Visualizing Changes
  1. Export your Git log to a .txt file from your project directory with git log --numstat >filename.txt
  2. Upload and import your Git log .txt file into eazyBI
  3. Create or import a report definition. Examples below
    1. Changes by Week Day and Hour https://eazybi.com/accounts/9041/cubes/Git%20Commits/reports/42597-git-commit-log-changes-by-week-day-and-hour
    2. Changes by Hour of Day https://eazybi.com/accounts/9041/cubes/Git%20Commits/reports/42592-git-commit-log-changes-by-hour-of-day

References