This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"printWidth": 110, | |
"singleQuote": true, | |
"useTabs": false, | |
"tabWidth": 2, | |
"semi": true, | |
"trailingComma": "all", | |
"arrowParens": "always", | |
"bracketSpacing": true, | |
"pugTabWidth": 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
mysql: | |
image: mysql | |
restart: always | |
command: --default-authentication-plugin=mysql_native_password | |
volumes: | |
- ./db:/var/lib/mysql | |
environment: | |
MYSQL_ROOT_PASSWORD: root | |
ports: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSteps(currentRail, numberRails) { | |
let step1 = (currentRail === numberRails) || (currentRail === 1) ? ((numberRails - 1) * 2) : ((numberRails - currentRail) * 2); | |
let step2 = (currentRail === numberRails) || (currentRail === 1) ? (step1) : ((currentRail - 1) * 2); | |
return [step1, step2] | |
} | |
function encodeRailFenceCipher(string, numberRails) { | |
let res = '' | |
for (let currentRail = 1; currentRail <= numberRails; currentRail++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function maxSumOfTwoRangesIn(arr) { | |
const ranges = [[]]; | |
for (let i = 0; i < arr.length; i++) { | |
const last = ranges.length - 1; | |
for (let j = 0; j <= last; j++) { | |
// ranges.push(ranges[j].concat(i)) | |
ranges.push([...ranges[j], i]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -z $TNF_API_KEY ]] | |
then | |
echo 'Error: TNF_API_KEY variable not found, please get api key from https://tinypng.com/developers and paste it in your ~/.zshrc or ~/.bashrc' | |
exit 1 | |
fi | |
for file in $(git status -s | grep -E '^[^D]{2}' | cut -c4- | grep -E "(.png|.jpg|.webp|.jpeg)") | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# step 1. find all uncommitted/changed images in sources dir and copy them to the buffer dir | |
for file in $(git status -s | cut -c4- | grep .png) | |
do | |
echo $file; | |
mkdir -p "./to_optimize/$(dirname $file)"; | |
cp $file "./to_optimize/$file"; | |
done | |
# step 2. optimize files in buffer dir by some third party service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
input_folder="./figma_export" | |
temp_export_folder="$(pwd)/temp_export" | |
export_zip_file_name="assets-icons-$(date +"%d-%m-%Y").zip" | |
assets_list_path="" | |
printf '\n' | |
echo 'Processing figma exported assets icons for AWS upload' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stdout = { | |
template: (val) => `\x1b[${val}m`, | |
reset: () => stdout.template(0), | |
cyanBright: (value) => stdout.template(96) + value + stdout.template(39) + stdout.reset(), | |
yellowBright: (value) => stdout.template(93) + value + stdout.template(39) + stdout.reset(), | |
redBright: (value) => stdout.template(91) + value + stdout.template(39) + stdout.reset(), | |
greenBright: (value) => stdout.template(92) + value + stdout.template(39) + stdout.reset(), | |
gray: (value) => stdout.template(30) + value + stdout.template(89) + stdout.reset(), | |
bold: (value) => stdout.template(1) + value + stdout.template(22) + stdout.reset(), | |
dim: (value) => stdout.template(2) + value + stdout.template(22) + stdout.reset(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getQueryParams = (str) => Object.fromEntries(Array.from(str.matchAll(/(?:([^?=&]+)=([^=&]+))/gm)).map(([_, param, value]) => [decodeURIComponent(param), decodeURIComponent(value)])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// binary search by key | |
const binarySearch = (phonebook, searchName) => { | |
if(phonebook.length === 0) { | |
return 'Phonebook is empty!' | |
} | |
let left = 0 | |
let right = phonebook.length - 1 | |
while(left <= right) { |
NewerOlder