Skip to content

Instantly share code, notes, and snippets.

View afreeorange's full-sized avatar
🐙

Nikhil Anand afreeorange

🐙
View GitHub Profile
@afreeorange
afreeorange / clsx.ts
Created September 21, 2024 18:50
clsx
/**
* Copy of:
* https://github.com/lukeed/clsx/blob/master/src/index.js
*/
export type ClassValue =
| ClassArray
| ClassDictionary
| string
| number
@afreeorange
afreeorange / sortKeys.ts
Created June 16, 2024 16:56
Sort Object Keys - TypeScript
/**
* Enumeration of data types.
* @enum {string}
*/
enum DataType {
OBJECT,
ARRAY,
STRING,
OTHER,
}
@afreeorange
afreeorange / subtitle-shifter.py
Created September 20, 2023 21:37
Quick script to offset subtitles in .srt files
"""
Quick script to offset subtitles in .srt files. Didn't
Google first to realize that this exists:
https://github.com/byroot/pysrt
Oh well.
"""
import re
@afreeorange
afreeorange / convertStreamToBuffer.js
Created August 7, 2023 22:44
Convert a Node Stream to a Buffer
const convertStreamToBuffer = async (
stream: NodeJS.ReadableStream
): Promise<Buffer> => {
return new Promise((resolve, reject) => {
let buffers: Uint8Array[] = [];
stream.on("data", (data) => {
buffers.push(data);
});
@afreeorange
afreeorange / cloudSettings
Last active October 14, 2021 19:48
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-10-14T19:48:42.588Z","extensionVersion":"v3.4.3"}