Skip to content

Instantly share code, notes, and snippets.

View SMWARREN's full-sized avatar

Sean Warren SMWARREN

View GitHub Profile
@SMWARREN
SMWARREN / createGlobalStore.ts
Created February 20, 2023 17:22 — forked from acorn1010/createGlobalStore.ts
Easier Zustand store
import {SetStateAction, useCallback} from 'react';
import create from "zustand";
export type EqualityFn<T> = (left: T | null | undefined, right: T | null | undefined) => boolean;
// eslint-disable-next-line @typescript-eslint/ban-types
const isFunction = (fn: unknown): fn is Function => (typeof fn === 'function');
/** Given a type `T`, returns the keys that are Optional. */
type OptionalKeys<T> =
@SMWARREN
SMWARREN / store.js
Created January 26, 2023 23:34
Better State Management Then Redux Context
// store.js
import React, {createContext, useReducer} from 'react';
const initialState = {};
const store = createContext(initialState);
const { Provider } = store;
const StateProvider = ( { children } ) => {
const [state, dispatch] = useReducer((state, action) => {
switch(action.type) {

Keybase proof

I hereby claim:

  • I am smwarren on github.
  • I am swarren (https://keybase.io/swarren) on keybase.
  • I have a public key ASBQQr25PV80D3SpK85aVKRUXlMccFDQL5lznu5p7jf8JAo

To claim this, I am signing this object:

[{ "long": "-80.7476887", "lat": "35.2180384", "name": "Shadow Point", "description": "The Best Shadow Burgers in town." },{ "long": "-80.7476887", "lat": "35.3180384", "name": "Mirror Point", "description": "Want to Stay Healthy?" },{ "long": "-80.843124", "lat": "35.227085", "name": "Focal Point", "description": "The Food That Focus's on you" }, { "long": "-84.207420", "lat": "35.863232", "name": "The New SPot", "description": "Chicken Wings!" } ]
@SMWARREN
SMWARREN / gist:ea891a1e5fd7daabcb07213c549b420b
Created February 17, 2018 08:48 — forked from Mikodes/gist:be9b9ce42e46c3d4ccb6
All Media queries for resolutions
/* (320x480) iPhone (Original, 3G, 3GS) */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
/* insert styles here */
}
/* (320x480) Smartphone, Portrait */
@media only screen and (device-width: 320px) and (orientation: portrait) {
/* insert styles here */
}