Skip to content

Instantly share code, notes, and snippets.

View emoss08's full-sized avatar
🖥️
Coding.... Per usual

Eric Moss emoss08

🖥️
Coding.... Per usual
View GitHub Profile
@emoss08
emoss08 / text_choices_to_const.py
Last active September 8, 2023 01:23
Converts models.TextChoices to Typescript Const
"""
Converts Models.TextChoices to TypeScript Const.
Primarily used for Select Fields
Example:
Input:
class JobFunctionChoices(models.TextChoices):
MANAGER = "MANAGER", _("Manager")
@emoss08
emoss08 / models_to_type.py
Last active February 25, 2024 23:48
Convert Django Models to Typescript Types
"""
Converts Django models to TypeScript types.
Example:
Input:
class JobTitle(GenericModel):
name = models.CharField(
_("Name"),
max_length=100,
@acorn1010
acorn1010 / createGlobalStore.ts
Last active April 1, 2024 01:11
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;
export type StoreType<State> = {
use<K extends keyof State>(
key: K,
defaultValue?: State[K],
equalityFn?: EqualityFn<State[K]>,
@techygrrrl
techygrrrl / Cargo.toml
Created October 1, 2022 07:20
First Rust app (guessing game)
[package]
name = "guessing_game"
version = "0.1.0"
edition = "2021"
authors = ["techygrrrl", "foo <foo@example.com>", "bar <bar@example.com>", "baz <baz@example.com>"]
description = "This is my firrrst Rrrust app!!!!"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]