Skip to content

Instantly share code, notes, and snippets.

View rokobuljan's full-sized avatar

Roko C. Buljan rokobuljan

View GitHub Profile
@rokobuljan
rokobuljan / .env
Created October 31, 2024 22:08
HTTPS for localhost development with local SSL certificates (Windows)
# Your HTTPS domain name i.e: local.dev
DOMAIN_NAME=
# Your server port i.e: 3000
PORT=
# Path to your local.dev+2-key.pem i.e: C:\\Users\\YOUR_USER_NAME\\local.dev+2-key.pem
SSL_KEY_PATH=
# Path to your local.dev+2.pem i.e: C:\\Users\\YOUR_USER_NAME\\local.dev+2.pem
SSL_CERT_PATH=
@rokobuljan
rokobuljan / qson.js
Created November 20, 2023 02:02
Concurrently (simultaneously) update JSON files via queue mechanism. [nodejs] [js] [json]
import fs from "fs-extra";
/**
* Concurrently (simultaneously) update JSON files via queue
* @example
* ```js
* import { QSON } from "./qson.js";
* const qconf = new QSON("./config.json");
*
* // Clear current file's data
@rokobuljan
rokobuljan / README.md
Created August 1, 2019 10:33
Automate Build Dist on Commit

Build-add

Build your /dist files on git commit!
How it works, if changes (diff) are detected in the staging area for a specific folder (i.e: /src), build-add.sh will trigger npm run build and add the new/modified build files to that commit on-the-fly.

Prerequisites:

npm i -D pre-commit

Configuration:

@rokobuljan
rokobuljan / columnify.js
Last active July 27, 2019 19:33
Pretty Print 2D Array data in terminal or console
/**
* columnify - Pretty Print 2D array to terminal or console
*
* @prop {Array} colsArr 2D array (table)
* @prop {Integer} tabs Number of max tabs (default 0)
* @return {String} Table-ordered values tab-separated with newlines
*/
const columnify = (colsArr, tabs) => {
const cols = colsArr[0].length;
@rokobuljan
rokobuljan / anagram.py
Created March 11, 2019 23:22
Anagrams Finder - Python
"""Anagrams finder
rokobuljan (GitHub) MIT licenced.
A simple O(n) complexity script to find anagrams in an unsorted
dictionary of words.
Use like: anagram.py words.txt word
Sample dictionary:
https://raw.githubusercontent.com/dwyl/english-words/master/words.txt
@rokobuljan
rokobuljan / _throttle-debounce.js
Created August 18, 2017 13:16
JS Throttle Debounce Functions
function throttle (cb, delay) {
let prevCall = +new Date();
return () => {
const time = +new Date();
if ((time - prevCall) >= delay) {
prevCall = time;
cb.apply(null, arguments);
}
};
}