Skip to content

Instantly share code, notes, and snippets.

View farishan's full-sized avatar

Faris Han farishan

View GitHub Profile
function debounce(func, timeout = 300) {
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => {
func.apply(this, args);
}, timeout);
};
}
@farishan
farishan / auth.plantuml
Last active August 6, 2023 06:57
Diagram Aktifitas Proses Autentikasi
@startuml
title Diagram Aktifitas Proses Autentikasi
start
:Pengguna membuka aplikasi;
:Pengguna ingin mengakses suatu bagian;
if (Apakah bagian yang ingin diakses tertutup?) then (YA)
:Aplikasi menunjukkan formulir autentikasi;
@farishan
farishan / style.css
Last active July 12, 2023 10:48
Base CSS, stylesheet, dark mode, font family system ui
:root {
--background-color: #f5f5f5;
--color: #222222;
--link-color: initial;
}
* {
box-sizing: border-box;
}
@farishan
farishan / f.html
Created July 4, 2023 13:12
bentuk html paling sederhana dan valid, contoh html paling sederhana dan valid
<!DOCTYPE html>
<html lang="en">
<head>
<title>f</title>
</head>
</html>
<main class="p-8">
<!-- Menu -->
<div class="MENU select-none border border-neutral-400 hover:border-neutral-600 rounded duration-200 p-4 text-neutral-600 text-center mb-8">
<p class="mb-4">Menu</p>
<nav class="space-y-2">
<button class="w-full border border-neutral-400 rounded hover:border-neutral-600 active:scale-95 py-2 px-4 hover:bg-neutral-100">
New Game
</button>
<button class="w-full border border-neutral-400 rounded hover:border-neutral-600 active:scale-95 py-2 px-4 hover:bg-neutral-100">
HTML5
CSS3
SQL
UML
XML
JavaScript: ES6
Game Engine: PixiJS, Phaser, Construct 2/3
React/AngularJS/VueJS
NuxtJS/NextJS
TypeScript
@farishan
farishan / MethodTextInterface.js
Created April 15, 2023 12:57
Execute object's method from text input
const object = {
help: function () {
console.log(`Object keys: ${Object.keys(this).filter(k => !k.includes('_')).join(', ')}`)
},
emit: function (payload) {
console.log(payload.join(' '))
},
_private: function () {
console.log('private')
}
@farishan
farishan / filenames.js
Created February 24, 2023 11:10
js script to get all filenames in a directory
//requiring path and fs modules
const path = require('path');
const fs = require('fs');
//joining path of directory
const directoryPath = path.join(__dirname, '');
//passsing directoryPath and callback function
fs.readdir(directoryPath, function (err, files) {
//handling error
if (err) {
return console.log('Unable to scan directory: ' + err);
@farishan
farishan / disciplines.txt
Last active February 13, 2023 12:05
A list of unique knowledge branches, sorted alphabetically, separated with comma. | Convert to JSON with this script: https://gist.github.com/farishan/6ac3cc654a9b58af71ac49de64e9f18a | Convert to https://mermaid.live/ with this script: https://gist.github.com/farishan/cffb456e8b7365442ec0ab11f45e8bc7
Aerospace Engineering,Aesthetics,Agricultural Science,Algebra,Anatomy,Anthropology,Archeology,Architectural Engineering,Architecture,Art History,Astronomy,Astrophysics,Biochemistry,Bioinformatics,Biology,Biomedical Engineering,Biotechnology,Botany,Business,Business Administration,Calculus,Cancer Biology,Cell Biology,Ceramics,Chemical Engineering,Chemistry,Civics,Civil Engineering,Classical Studies,Climate Science,Cognitive Science,Commerce,Commercial Law,Communication Studies,Comparative Literature,Comparative Religion,Computer Science,Creative Writing,Criminology,Cultural Studies,Dance,Dental Science,Development Studies,Earth Science,Ecology,Econometrics,Economics,Education,Education Studies,Electrical Engineering,Electronic Engineering,Emergency Medicine,Energy Engineering,Engineering,English Literature,Environmental Economics,Environmental Engineering,Environmental Science,Ethics,Fashion Design,Film Studies,Finance,Gender Studies,Genetics,Geography,Geology,Geometry,Gerontology,Global Studies,Graphic Design
const fs = require('fs')
/* Configuration */
const INPUT_PATH = './disciplines.txt'
const OUTPUT_PATH = './disciplines.mermaid.txt'
const ENCODING = 'utf-8'
const MINIFIED = false
const SPACE = 2
const REPLACER = undefined