Skip to content

Instantly share code, notes, and snippets.

View mrv1k's full-sized avatar
🔧
still setting up neovim...

Viktor Khotimchenko mrv1k

🔧
still setting up neovim...
View GitHub Profile
@mrv1k
mrv1k / init.vim
Created August 18, 2021 17:16
wip backups of my nvim config
" set path+=**
" Nice menu when typing `:find *.py`
" set wildmode=longest,list,full
" set wildmenu
set wildmenu " Show list instead of just completing
set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
" Ignore files
set wildignore+=*.pyc
@mrv1k
mrv1k / secondsToTime.js
Created May 11, 2021 22:28
2 ways to convert seconds to time object
const MINUTE = 60;
const HOUR = MINUTES * 60;
const DAY = HOUR * 24;
function secondsToTime1(timestamp) {
let time = timestamp;
const days = Math.floor(time / DAY);
time -= days * DAY;
const hours = Math.floor(time / HOUR);
time -= hours * HOUR;
ZSH_THEME="mh"
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/mrv1k/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
@mrv1k
mrv1k / cloudSettings
Last active August 2, 2019 19:33
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-08-02T19:33:43.887Z","extensionVersion":"v3.4.1"}
@mrv1k
mrv1k / .eslintrc.js
Last active September 23, 2022 16:25
Resolve path starting "@/*". eslint-plugin-import / eslint-import-resolver-webpack
/**
* Good article to read what is `@` in `.vue` files
* {@link https://www.jerriepelser.com/blog/til-at-symbol-javascript-import/}
*
* More on `import/no-unresolved` rule:
* {@link https://github.com/benmosher/eslint-plugin-import/blob/HEAD/docs/rules/no-unresolved.md#ignore}
*/
// `/` is just for sanity and can be ommited.
// Add this line to your .eslint.rc
@mrv1k
mrv1k / veeValidateCustomMap.js
Created March 23, 2018 14:55
`veeValidate` custom mapping. Receive unmapped errors object structure and map it manually
// Receive unmapped errors object structure. More here: http://vee-validate.logaretm.com/api.html#error-bag
function mapFieldToErrorType(unmapped) {
const mapped = {};
for (const error in unmapped) {
// data-vv-name = error.rule
mapped[error] = unmapped[error][0].rule;
}
return mapped;
}
@mrv1k
mrv1k / chrome_util_pages.js
Last active November 3, 2017 03:34
List of chrome browser utility pages that you should consider filtering out. https://developer.chrome.com/extensions/events#filtered
const utilPages = [
'chrome://extensions/',
'chrome://newtab/',
'chrome://settings/',
'chrome://history/',
'chrome://downloads/',
'chrome://bookmarks/',
'chrome-extension://extensionid/',
];
@mrv1k
mrv1k / filterChromeOnUpdated.js
Last active October 19, 2022 22:09
Filter out page refresh, page loaded or chrome pages from chrome.tabs.onUpdated
const loadedTabs = {}; // global
// call within a function that hsa access to 'tab' permission
function load(tabId) {
[loadedTabs[tabId]] = response;
}
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if ((tabId !== tab.id && loadedTabs[tabId]) || /(chrome)(?:[/:-])/.test(tab.url)) return;
if (changeInfo.status === 'complete' && tab.active) {
doYourThing();
@mrv1k
mrv1k / cloudSettings
Last active December 4, 2018 16:13
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-12-04T16:13:28.600Z","extensionVersion":"v3.2.2"}
@mrv1k
mrv1k / bubbleSort.js
Last active May 5, 2017 03:56
Simple sorting algorithms in JavaScript
var testArr = [4, 2, 6, 8, 1, 3, 7, 5];
function bubbleSort(arr) {
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < arr.length - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
let bubble = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = bubble;
}