Skip to content

Instantly share code, notes, and snippets.

View great-elephant's full-sized avatar
🐘
I may be slow to respond.

Great Elephant great-elephant

🐘
I may be slow to respond.
View GitHub Profile
@great-elephant
great-elephant / id-gen.ts
Created June 9, 2024 07:43
ID Generator
/**
* Refs:
* - https://gist.github.com/CatsMiaow/b479e96d5613dbd4711ab6d768b3eea0
* - https://stackoverflow.com/a/61852309
*/
class BigIntBase62 {
private static CHARSET =
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
static encode(integer: bigint | number): string {
@great-elephant
great-elephant / batch-processor.ts
Last active September 28, 2023 15:58
Batch Processor
type BatchConfig = {
/**
* Maximum number of data items for a batch.
*/
size: number;
/**
* Maximum timeout for executing a batch in millisecond.
*/
timeout: number;
@great-elephant
great-elephant / gist:318ed0e0088298acc7fc65d8736de383
Last active December 18, 2019 04:09 — forked from johanmeiring/gist:3002458
"git lg" alias for pretty git log
# From http://garmoncheg.blogspot.com/2012/06/pretty-git-log.html
git config --global alias.lg "log -n 10 --color --graph --pretty=format:'%Cgreen%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@great-elephant
great-elephant / table.html
Created January 17, 2019 08:07 — forked from dunhamsteve/table.html
Example of a scrollable table that only renders visible rows
<!-- This code is public domain, share and enjoy. -->
<html>
<style type="text/css" media="screen">
#table {
position: absolute;
top: 30px;
bottom: 0;
left: 10px;
right: 10px;
}