Skip to content

Instantly share code, notes, and snippets.

View calendee's full-sized avatar

Calendee LLC calendee

View GitHub Profile
@calendee
calendee / utils.ts
Last active July 23, 2021 13:10
Async Wrapper Function & JSON Fetch Handler
// Based on https://www.maxpou.fr/async-await-without-try-catch and https://github.com/DavidWells/safe-await/pull/2/files
export function wrapAsyncFn<T>(somePromise: Promise<T>) {
return somePromise.then((data) => [null, data]).catch((err) => [err, null]);
}
// Based on https://www.youtube.com/watch?v=aIboXjxo-w8
export async function fetchJson(
input: RequestInfo,
init?: RequestInit | undefined,
) {
@calendee
calendee / safari-open-pages.py
Created January 17, 2021 18:47 — forked from aleks-mariusz/safari-open-pages.py
This script fetches the current open tabs in all Safari windows. Useful to run remotely on your mac when you are at work and want to read a page you have open (remotely) at home but don't remember the url but can log in to your home system on the command line
#!/usr/bin/python
#
# This script fetches the current open tabs in all Safari windows.
# Useful to run remotely on your mac when you are at work and want
# to read a page you have open (remotely) at home but don't remember
# the url but can log in to your home system on the cmmand line
#
import sys
@calendee
calendee / App.js
Last active November 4, 2020 13:26
react-native-styled.macro useStyles Hook Concept
//////////////////////////////////
// Start useStyles.js
import { useMemo } from "react";
import styled from "react-native-styled.macro";
import { useWindowVariant } from "react-native-styled.macro/lib";
export function useStyles(styleDefinition) {
const variants = useWindowVariant();
@calendee
calendee / SwipeProvider.tsx
Created May 27, 2020 10:32
React Native Gesture Handler Swipe
import React, { createContext, ReactNode, useMemo, useState } from "react";
type SwipeContextProps = {
openedItemKey: string;
setOpenedItemKey: (key: string) => void;
};
type SwipeProviderProps = {
children: ReactNode;
initialOpenedItemKey: string;
@calendee
calendee / Presentation.md
Created September 10, 2019 12:37
ReactJS Dallas Meetup Presentation
@calendee
calendee / .eslintignore
Created April 12, 2019 12:13
TypeScript and Prettier Integration with `@typescript-eslint/parser`
dist/**/*.js
@calendee
calendee / AndroidManifest.xml
Created February 20, 2019 16:30
Android Manifest Changes
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
@calendee
calendee / Launch-AVD.REAME
Last active February 8, 2019 22:18
Launch Android Emulator from a Mac Command Line without Opening Android Studio
# Put this in your `~/.bash_profile`
export ANDROID_HOME=/Users/YOUR_USER_DIRECTORY_HERE/Library/Android/sdk
# NOTE: To use this right away in the same terminal or any
# currently open terminal, you'll need to source it:
> source ~/.bash_profile
# Now, see what emulators you have:
import React from 'react'
import { NextContext } from 'next'
// Define what an individual item looks like
interface IDataObject {
id: number,
name: string
}
// Define the props that getInitialProps will inject into the component
import { NextFunctionComponent, NextContext } from 'next'
// Define what an individual item looks like
interface IDataObject {
id: number,
name: string
}
// Define the props that getInitialProps will inject into the component
interface IListComponentProps {