This file contains hidden or 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 implode() { | |
local IFS="${1}"; | |
shift; | |
echo "${*}"; | |
} | |
echo $(implode ${1} ${@:2}) |
This file contains hidden or 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 | |
function index_of() { | |
index=0; | |
for arg in ${@:2}; do | |
index=$((index + 1)) | |
if [[ ${1} == ${arg} ]]; then | |
echo ${index}; | |
break; | |
fi | |
done |
This file contains hidden or 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 remainingDays(date) { | |
let time = new Date(date.getTime()); | |
time.setMonth(date.getMonth() + 1); | |
time.setDate(0); | |
return time.getDate() > date.getDate() ? time.getDate() - date.getDate() : 0; | |
} |
This file contains hidden or 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
/** | |
* Separating days by week with init day setting | |
* | |
* @param days | |
* @param initDay | |
* @param initWeekDay | |
* @returns {Array[]} | |
*/ | |
function separateDaysByWeek(days, initDay, initWeekDay = 0) { | |
let result = [[]]; |
This file contains hidden or 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
/** | |
* Group your items in array by multiple keys! | |
* | |
* @param collection | |
* @param retrieveFunctions | |
* @param compareFunctions | |
* @returns {Array} | |
*/ | |
function groupify( | |
collection, |
This file contains hidden or 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
/** | |
* Simple usage: | |
* Initing: | |
* $.search.init( | |
* '.node' // Selector of elements | |
* ['.inner_title', 'description', 'comments'], // Colelciton of selectors where is need to search substring, | |
* 'search-ui', // Name of data attribute to write index of element to search and state | |
* 'search-highlight' // Name of class for highlighting of find substrings | |
* ); | |
* Searching: |
This file contains hidden or 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
sudo chown $USER:docker /var/run/docker.sock |
This file contains hidden or 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
clean regex: | |
^[ыЫа-яА-Яa-zA-ZіІєЄґҐїЇ]{2}\d{6}$ | |
php: | |
/^[ыЫа-яА-Яa-zA-ZіІєЄґҐїЇ]{2}\d{6}$/u |