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);
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
const fs = require('fs')
/* Configuration */
const INPUT_PATH = './disciplines.txt'
const OUTPUT_PATH = './disciplines.json'
const ENCODING = 'utf-8'
const MINIFIED = false
const SPACE = 2
const REPLACER = undefined