Skip to content

Instantly share code, notes, and snippets.

View karega's full-sized avatar

Karega McCoy karega

View GitHub Profile
@karega
karega / meta-prompt.md
Created August 27, 2025 14:11
Meta-prompt

👇 Meta-prompt for generating pytest tests

You are generating pytest tests for a FastAPI + SQLAlchemy project. Absolute rule: Do not create or connect to any real database (no engines, no SQLite, no file or memory DB). All DB access must be mocked.

Step 1 — Discover the repo’s fixtures & hooks

  1. Open conftest.py (or contest.py if that’s what the repo uses). List the exact fixture names you can use:
  • FastAPI app: app (or test_app)
@karega
karega / rico-wp.md
Last active July 27, 2025 14:27
RICO (Stake KJP) Whitepaper

Staked $KJP aka the RICO token

Abstract

This document outlines a sustainable and fair financial model for an hourglass-style smart contract. It defines the economic rules, participant incentives, and structural workflows to maintain transparency, fairness, and equilibrium in capital flow. The goal is to design a mechanism that rewards participation without relying on deception, while maintaining sustainable liquidity and clear visibility for all stakeholders.

Introduction

Hourglass contracts operate on a simple principle: participants deposit $KJP into a shared pool and may only withdraw their value if new participants enter after them. While this creates an inherently risky but potentially lucrative mechanism, fairness, transparency, and sustainability are often neglected. This whitepaper proposes a financial model that balances these goals and defines clear exit and entry workflows with embedded safeguards.

@karega
karega / sample-table.md
Created July 17, 2025 17:56
Sample Table w/ Data
Metric Day 4 Day 3 Day 2 Day 1
Sales 1300 ↑ +75 1225 ↓ -25 1250 ↑ +50 1200 (n/a)
Signups 305 → 0 305 ↓ -5 310 ↑ +10 300 (n/a)
Churn % 2.1% ↓ -0.3 2.4% ↓ -0.1 2.5% ↑ +0.2 2.3% (n/a)
@karega
karega / happy-hour.md
Created June 10, 2025 03:33
Happy Hour Game Idea

🎮 Happy Hour - A Twitter-Integrated Match-3 Game

Happy Hour is a social, skill-based match-3 game platform that connects directly with Twitter (X) for interactive, competitive gameplay. It blends the addictive mechanics of puzzle games with the public virality of social media—and it’s powered by a unique token-based economy.


🧩 How It Works

🧑‍🎨 1. The Host Creates a Game

@karega
karega / typeahead.js
Created June 9, 2025 19:09
React TypeAhead
// FuseTypeahead.jsx
import React, { useState, useMemo, useCallback } from 'react';
import Fuse from 'fuse.js';
import debounce from 'lodash.debounce';
// Import or define your user data (shortened here)
const users = [
{
name: "Elnora Zimmerman",
email: "elnora_zimmerman@intrawear.cbn",
@karega
karega / useDelegationService.ts
Created May 5, 2025 19:14
Delegation Service
import { useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { RootState } from '../state/store'; // adjust import path
import { useGetDelegationsQuery } from '../state/delegations-api'; // RTK Query API hook
export function useDelegations() {
const dispatch = useDispatch();
// Select delegations from state
const delegations = useSelector((state: RootState) => state.delegations?.data);
@karega
karega / delegation-service.js
Created May 5, 2025 00:40
Delegation Service
// services/vehicleService.js
import { useSelector, useDispatch } from 'react-redux';
import { setField, setVehicle } from 'state/slices/vehicleSlice';
import { vehicleApi } from 'state/api/vehicleApi';
export const useVehicleService = () => {
const dispatch = useDispatch();
const vehicle = useSelector((state) => state.vehicle);
const updateVehicle = vehicleApi.endpoints.updateVehicle.useMutation()[0];
const fetchVehicle = vehicleApi.endpoints.getVehicleById.useLazyQuery()[0];
@karega
karega / slice.js
Created May 3, 2025 18:20
Sample state slice
import { createSlice } from "@reduxjs/toolkit";
import * as R from "ramda";
import { produce } from "immer";
const initialState = {};
const vehicleSlice = createSlice({
name: "vehicle",
initialState,
reducers: {
@karega
karega / api.js
Created May 3, 2025 18:19
Sample api code
import { createApi } from "@reduxjs/toolkit/query/react";
import axios from "axios";
import { concatMap, filter, from, map, take, timer } from "rxjs";
import { questionsLoaded } from "state/questions-slice";
import { vehicleLoaded } from "state/vehicle-slice";
import { transformerService } from "app/services";
const observableQuery =
({ baseUrl } = { baseUrl: "" }) =>
async ({ url, method, data, params, headers, defilter = () => true }) => {
@karega
karega / store.js
Created May 3, 2025 18:16
Sample redux store
import { configureStore } from "@reduxjs/toolkit";
import { setupListeners } from "@reduxjs/toolkit/query";
import { persistStore, persistReducer } from "redux-persist";
import storage from "redux-persist/lib/storage";
// Import the API object
import { queryApi } from "state/query-api";
import { recordApi } from "state/record-api";
// Import state objects