Skip to content

Instantly share code, notes, and snippets.

View KaMeHb-UA's full-sized avatar
🇺🇦
working from Ukraine, for Ukraine

KaMeHb-UA

🇺🇦
working from Ukraine, for Ukraine
  • Ukraine
  • 04:08 (UTC +03:00)
View GitHub Profile
@KaMeHb-UA
KaMeHb-UA / main.js
Created May 2, 2018 13:26
Simple browser __filename and __dirname realization (checked on Chrome and Firefox)
(()=>{const __filename=(a=>{return `${a[a.length-3]}://${a[a.length-2]}`})((new Error('')).stack.split(/(\w+):\/\/(\S+):\d+:\d+/)),__dirname=(a=>{a.pop();return a.join('/')})(__filename.split('/'));(()=>{
console.log([__filename, __dirname])
})()})()
@KaMeHb-UA
KaMeHb-UA / .bashrc
Created March 18, 2018 16:13
Beautiful and useful .bashrc example for TRUECOLOR terminals
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth