Skip to content

Instantly share code, notes, and snippets.

View vansosnin's full-sized avatar
🎸
fall into the light

Ivan Sosnin vansosnin

🎸
fall into the light
View GitHub Profile
@vansosnin
vansosnin / findColor.js
Last active June 13, 2020 07:42
Find closest colors
// https://gamma-cveta.ru/kolerovka-krasok
// https://www.robotint.ru
// run example
getSimilarColors("#41594F", 60, 60, 50);
// utility
const clamp = (value, min, max) => {
let _value = value;
_value = Math.max(min, _value);
@vansosnin
vansosnin / profiles.json
Created March 20, 2020 08:31
Windows Terminal Settings
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"profiles":
{
@vansosnin
vansosnin / .zshrc
Created May 27, 2018 19:08
zsh config
# Source https://medium.com/@caulfieldOwen/youre-missing-out-on-a-better-mac-terminal-experience-d73647abf6d7
# 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/ivansosnin/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
@vansosnin
vansosnin / vscode_ext.sh
Last active October 10, 2018 16:19
VSCode settings and stuff
ext install file-templates
ext install vscode-eslint
ext install intellij-idea-keybindings
ext install javascriptsnippets
ext install material-icon-theme
ext install material-theme
ext install nord-visual-studio-code
ext install prettier-vscode
ext install project-manager
ext install quokka-vscode
@vansosnin
vansosnin / count.sh
Last active December 19, 2018 06:23
Count stuff in bash and powershell
find ./path/to/dir -mindepth 1 -type f -name "*.js" | wc -l # count files
find ./path/to/dir -mindepth 1 -type f -name "*.js" -exec cat {} + | wc -l # count lines
dir -Recurse *.txt | Get-Content | Measure-Object -Line # powershell count lines
Get-Childitem c:\local -Recurse | where { -not $_.PSIsContainer } | group Extension -NoElement | sort count -desc # powershell count files
@vansosnin
vansosnin / remove_newline.sh
Created September 26, 2016 17:42
Remove newline at the end of file
perl -pi -e 'chomp if eof' filename
@vansosnin
vansosnin / atom_plugins.sh
Last active August 15, 2017 19:36
My Atom config
#plugins
apm install pigments react autoclose-html emmet sunset file-icons linter linter-eslint linter-stylelint highlight-selected simple-drag-drop-text autocomplete-modules auto-update-packages double-tag prettier-atom
# themes
apm install spacegray-dark-ui spacegray-dark-syntax
@vansosnin
vansosnin / number_format.js
Created December 13, 2015 11:19
PHP's number_format function for JS
function number_format(number, decimals, dec_point, thousands_sep) {
var i, j, kw, kd, km;
if (isNaN(decimals = Math.abs(decimals))) {
decimals = 2;
}
if (dec_point == undefined) {
dec_point = ",";
}
if (thousands_sep == undefined) {
@vansosnin
vansosnin / gradiend_round_opacity_border.css
Created September 25, 2015 16:06
Gradient rouded border with opacity
/*
<div class="control-wrapper">
<div class="control-wrapper__opacity"></div>
<a href="javascript:void(0);" class="control simple-btn clear-btn">Очистить матрицы</a>
</div>
*/
.control-wrapper {
padding: 1px;
border-radius: 3px;
@vansosnin
vansosnin / seek_destroy_process.bat
Last active March 1, 2016 04:40
Find and kill process (windows)
netstat -o -n -a | findstr :8080 # find process on port 8080
taskkill /f /PID 666 # kill this process
taskkill /F /IM chrome.exe # kill all chrome processes