Skip to content

Instantly share code, notes, and snippets.

@redVi
redVi / format-phone.js
Created December 19, 2023 14:53 — forked from maximal/format-phone.js
Format phone number
/**
* Отформатировать телефонный номер.
*
* Для мобильных код отбивается пробелами, для домашних — скобками.
*
* Грамотно обрабатываются только русские номера,
* для остальных функция пытается отформатировать более-менее нормально.
*
* Для отбивания цифр используются не просто дефисы, а специальные цифровые чёрточки, не хухры.
*
@redVi
redVi / resetXcode.sh
Created April 8, 2020 15:08 — forked from maciekish/resetXcode.sh
Reset Xcode. Clean, clear module cache, Derived Data and Xcode Caches. You can thank me later.
#!/bin/bash
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
open /Applications/Xcode.app
@redVi
redVi / nuke-deps.sh
Created April 7, 2020 14:54 — forked from jsdario/nuke-deps.sh
Script to clean watchman, remove node_modules, clean cache and restart packager for React Native troubleshooting.
#!/bin/bash
# Stop cached listeners
watchman watch-del-all
# Remove installed modules
rm -rf node_modules
# Remove yarn meta files
rm yarn*
@redVi
redVi / index.js
Created February 7, 2019 14:58 — forked from isRuslan/index.js
JS: find one unique value from duplicate array
/*
Given the array of IDs, which contains many duplicate integers
and one unique integer, find the unique integer.
*/
// O(n^2): loop in loop
function find_unique_brute (array) {
var result = null, n = array.length;
@redVi
redVi / gist:04ace75b96f7408e220fe6bb971a85cc
Created September 29, 2017 15:03 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name