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 / continents.json
Created January 16, 2022 21:02
Continents with phone codes
{
"continents": [
{
"name": "Africa",
"countries": [
{
"name": "Angola",
"phone": "244",
"native": "Angola",
"capital": "Luanda"
@redVi
redVi / .travis.yml
Created May 16, 2021 15:17
react-native ci/cd
matrix:
include:
- os: osx
podfile: ios/Podfile
language: objective-c
osx_image: xcode12
cache:
yarn: true
cocoapods: true
@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
@redVi
redVi / verbs.tex
Last active August 29, 2015 13:58
English verbs. Mind map.
\documentclass[a4paper]{article}
\usepackage[russian]{babel}
\usepackage[utf8]{inputenc} % UTF-8
\usepackage{tikz} % include TikZ
\usetikzlibrary{mindmap, trees, shadows} % TikZ library
\usepackage{verbatim}
\usepackage[left=2cm,right=2cm,
top=2cm,bottom=2cm,bindingoffset=0cm]{geometry}
\usepackage{color} % you may define RGB colors
@redVi
redVi / i18n_filter.rb
Last active June 24, 2020 05:34
Jekyll localization. Author unknown.
require 'i18n'
LOCALE = 'ru'
module Jekyll
module I18nFilter
def localize(input, format=nil)
load_translations
format = (format =~ /^:(\w+)/) ? $1.to_sym : format
I18n.l input, :format => format, :locale => LOCALE
@redVi
redVi / sitemap.xml
Created February 19, 2014 16:49
sitemap of jekyll blog
---
layout: none
sitemap:
priority: 1.0
changefreq: weekly
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for post in site.posts %}
<url>