Skip to content

Instantly share code, notes, and snippets.

View AykutSarac's full-sized avatar

Aykut Saraç AykutSarac

View GitHub Profile
@AykutSarac
AykutSarac / csv-parser.ts
Last active December 29, 2023 11:50
Zero dependency CSV parser in TypeScript with generics support
type CSVRow<T> = Record<keyof T, string | number>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
class CSVParser<T = any> {
private rows: CSVRow<T>[];
private header: (keyof T)[];
constructor(csvData: string) {
this.rows = this.parseCSV(csvData);
this.header = this.rows.length > 0 ? (Object.keys(this.rows[0]) as (keyof T)[]) : [];
@AykutSarac
AykutSarac / TaskManager.py
Created April 3, 2022 20:23
Beautiful Python Task Manager CLI
from InquirerPy import prompt
import os
import psutil
customStyle = {
"question": "#cc00ff bold",
"pointer": "#ff9d00",
"answer": "#39a7e6 bold",
"fuzzy_match": "#2cf56c bold",
@AykutSarac
AykutSarac / depthFirstSearch.js
Created August 18, 2021 12:27
depthFirstSearch (array to map)
// Initialize Depth First Search
// see https://en.wikipedia.org/wiki/Depth-first_search
const depthFirstSearch = (graph, source) => {
console.log(source);
for (let neighbour of graph.get(source)) {
depthFirstSearch(graph, neighbour);
}
};
@AykutSarac
AykutSarac / guessTheBox.js
Last active May 11, 2021 14:47
Discord 3x3 Grid Guess Game
/*
- NOTE TO THE READER -
This is the Discord bot command for making 3x3 grid guessing game.
□ □ □
□ □ □
□ □ □
User guessing a position and responding in following structure "y x"
which y is row and x is column (e.g: 2 3 aka 2nd row 3th column) and it