Skip to content

Instantly share code, notes, and snippets.

View sheppardjm's full-sized avatar
🏠
Working from home

jamison sheppard sheppardjm

🏠
Working from home
View GitHub Profile
@sheppardjm
sheppardjm / actions.ts
Created October 5, 2023 22:11
Add a new Kinde organization in server components using Nextjs server actions
"use server";
import { redirect } from "next/navigation";
export async function createOrgAction(formData: FormData) {
const org = formData.get("org");
redirect(`/organization/${org}`);
}
@sheppardjm
sheppardjm / iffe.js
Created October 20, 2022 23:51
Javascript Immediate invocation
//example declaration
(function() {
//do something
})();
//alternative declaration
(function() {
//do something
}());
@sheppardjm
sheppardjm / expo-cli-workarounds.sh
Last active October 17, 2022 18:22
Android/iOS simulator cli workarounds for expo errors
# Android Sim fails to open
$ {/Path/To/Library/Android/sdk/emulator/emulator} {@Device_API_#}
# Expo Go fails to install on Android emulator
$ adb -s {emulator-name} install {/Path/To/.expo/android-apk-cache/Exponent-2.22.3.apk}
# List iOS simulator devices
$ xcrun simctl list devices
#List Android emulator devices
@sheppardjm
sheppardjm / schema.graphql
Created June 22, 2022 13:51
Graphql type with unit argument field
type SoilTest {
id: ID!
fieldID: ID!
date: String
testID: String
ph: Float
p2o5(unit: p2o5Unit = LBS_PER_ACRE): Float
k2o(unit: k2oUnit = LBS_PER_ACRE): Float
om: Float
cec: Float
h1 {
/* font-size: clamp(min, ideal, max); */
font-size: clamp(20px, 10vw, 200px);
}
/* Set ideal in vw to tie font size to browser width (i.e. 1000px wide == font-size: 100px */
@sheppardjm
sheppardjm / formikMock.test.js
Created October 26, 2021 16:13
Mocking Formik connect HOC and useFormikContext for Jest
const mockInitialValue = { test: "" };
const mockSetValue = { test: "" };
const mockErrors = { test: "" };
jest.mock("../path/to/formik", () => ({
useFormikContext: jest.fn().mockImplementation(() => {
return {
setFieldValue: () => {
return mockSetValue;
},
@sheppardjm
sheppardjm / default.sublime-keymap
Last active August 29, 2015 14:04
SideBarGit liberal git command Sublime key binding
[
{ "keys": ["shift+super+g"], "command": "side_bar_git_liberal" }
]