Skip to content

Instantly share code, notes, and snippets.

Avatar

Roko C. Buljan rokobuljan

View GitHub Profile
@rokobuljan
rokobuljan / README.md
Created August 1, 2019 10:33
Automate Build Dist on Commit
View README.md

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
View columnify.js
/**
* 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
View anagram.py
"""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 / gist:504be05ab4faf050d074d22f77cb6748
Created February 4, 2018 21:59
Get Unicode HEX Value of a Special Character - for use in CSS, HTML, JavaScript
View gist:504be05ab4faf050d074d22f77cb6748
// Given a special character (• in this example), open up Developer Console and write
"•".charCodeAt(0).toString(16) // "2022"
/** Use like:
*
* HTML:
* •
*
* CSS:
@rokobuljan
rokobuljan / _throttle-debounce.js
Created August 18, 2017 13:16
JS Throttle Debounce Functions
View _throttle-debounce.js
function throttle (cb, delay) {
let prevCall = +new Date();
return () => {
const time = +new Date();
if ((time - prevCall) >= delay) {
prevCall = time;
cb.apply(null, arguments);
}
};
}