Skip to content

Instantly share code, notes, and snippets.

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

Eze Sunday ezesundayeze

🏠
Working from home
View GitHub Profile
@isocroft
isocroft / react-testing-library-helpers.tsx
Last active January 18, 2024 16:53
Helper functions for react-testing-library to make writing tests a lot easier and faster while maintaining quality feedback
import React from "react";
import { Provider as ReactReduxProvider } from "react-redux";
import { IntlProvider as ReactIntlProvider } from "react-intl";
import { BrowserRouter, BrowserRouterProps, MemoryRouter, MemoryRouterProps, Router, RouterProps } from "react-router-dom";
import { History, LocationDescriptor, createBrowserHistory, createMemoryHistory } from "history";
import { render, RenderOptions, RenderResult } from "@testing-library/react";
import { renderHook, RenderHookResult, RenderHookOptions } from "@testing-library/react-hooks";
type Separate<F, O> = F extends O ? F : null;
type Writeonly<T> = Separate<keyof T, keyof Readonly<T>>;
@isocroft
isocroft / object-util.ts
Last active July 3, 2023 16:32
A ReactJS hook that filters any generic kind of list/array (of strings or of similar dictionary objects) using a text search term targeting one or more properties in the dictionary object in the list using 3 different text search algorithms (complete, fuzzy, specific) with options to extend with your custom text search algorithm
type Literal = unknown
export interface ReducableObject {
[key:string]: Literal | ReducableObject;
}
export function throttleFilterCallbackRoutine<S, N extends () => void> (
routine: (...args: [S]) => N,
routineArgs: [S],
interval = 500
@jeremychone
jeremychone / rust-xp-02-postgresql-sqlx.rs
Created May 11, 2021 05:48
Rust to PostgreSQL with SQLX | Rust By Example
#![allow(unused)] // silence unused warnings while exploring (to comment out)
use sqlx::postgres::{PgPoolOptions, PgRow};
use sqlx::{FromRow, Row};
// Youtube episode: https://youtu.be/VuVOyUbFSI0
// region: Section
// Start postgresql server docker image:
@marians
marians / CouchDB_Python.md
Last active April 9, 2024 12:21
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

@segebee
segebee / gist:7dde9de8e70a207e6e19
Created June 22, 2015 17:30
Nigeria States and Local Government Areas JSON - codingsavvy.com
[{"state":{"name":"Abia State","id":1,"locals":[{"name":"Aba South","id":1},{"name":"Arochukwu","id":2},{"name":"Bende","id":3},{"name":"Ikwuano","id":4},{"name":"Isiala Ngwa North","id":5},{"name":"Isiala Ngwa South","id":6},{"name":"Isuikwuato","id":7},{"name":"Obi Ngwa","id":8},{"name":"Ohafia","id":9},{"name":"Osisioma","id":10},{"name":"Ugwunagbo","id":11},{"name":"Ukwa East","id":12},{"name":"Ukwa West","id":13},{"name":"Umuahia North","id":14},{"name":"Umuahia South","id":15},{"name":"Umu Nneochi","id":16}]}},{"state":{"name":"Adamawa State","id":2,"locals":[{"name":"Fufure","id":1},{"name":"Ganye","id":2},{"name":"Gayuk","id":3},{"name":"Gombi","id":4},{"name":"Grie","id":5},{"name":"Hong","id":6},{"name":"Jada","id":7},{"name":"Lamurde","id":8},{"name":"Madagali","id":9},{"name":"Maiha","id":10},{"name":"Mayo Belwa","id":11},{"name":"Michika","id":12},{"name":"Mubi North","id":13},{"name":"Mubi South","id":14},{"name":"Numan","id":15},{"name":"Shelleng","id":16},{"name":"Song","id":17},{"name":"Toung
@svineet
svineet / Calc.bas
Created September 30, 2012 07:19
QBASIC Code for a simple calculator program
CLS
SCREEN 13
PRINT "CALCULATOR-"
PRINT "ENTER YOUR EXPRESSION"
PRINT "EXAMPLE-58 * 20"
PRINT "THE TERMS SHOULD BE SEPARATED BY SPACE OR ERROR WILL OCCUR"
INPUT "ENTER YOUR EXPRESSION-"; EXP$
EXP$ = EXP$ + " "