Skip to content

Instantly share code, notes, and snippets.

View anton-chernianu's full-sized avatar
🚀
frontend

Anton anton-chernianu

🚀
frontend
View GitHub Profile
@anton-chernianu
anton-chernianu / node_cpulimit.sh
Created June 22, 2023 09:56
Launch cpulimit for all node js processes
#!/bin/bash
CPULIMIT_PERCENT=20
# Launch cpulimit in the background for the specified Node process
limit_node_process() {
local pid=$1
cpulimit -p "$pid" -l "$CPULIMIT_PERCENT" &
}
@anton-chernianu
anton-chernianu / gitlab-reviewers.js
Created September 7, 2022 16:04
GitLab automatic addition of reviewers to MR [JS Snippet]
const USER_NAMES = [
'a.chernianu',
'a.chernianu',
'a.chernianu',
]
const reviewerBtn=document.querySelector(".js-reviewer-search"),eventInput=new Event("input",{bubbles:!0,cancelable:!0}),enterEvent=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,keyCode:13}),wait=async a=>new Promise(b=>setTimeout(b,a)),searchUser=async a=>new Promise(async c=>{let b=document.querySelector(".dropdown-menu-reviewer .dropdown-input-field");b.value=a,b.dispatchEvent(eventInput),await wait(1e3);let d=document.querySelectorAll(".dropdown-menu-user-link")[0];d.dispatchEvent(enterEvent),c(!0)});(async()=>{reviewerBtn.click(),await wait(200);for(let a=0;a<USER_NAMES.length;a++)await searchUser(USER_NAMES[a])})()
@anton-chernianu
anton-chernianu / .gitignore
Created December 25, 2019 12:25 — forked from FullStackForger/.gitignore
.gitignore for Unity3d project
###
# Unity folders and files
###
[Aa]ssets/AssetStoreTools*
[Bb]uild/
[Ll]ibrary/
[Ll]ocal[Cc]ache/
[Oo]bj/
[Tt]emp/
[Uu]nityGenerated/
@anton-chernianu
anton-chernianu / index.js
Last active December 13, 2019 15:03
JavaScript: Regex matching links without <a> and replace
function addTagToLinks(str) {
const httpRegex = "((?:(http|https|Http|Https|rtsp|Rtsp):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)"
+ "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_"
+ "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,25})?\\@)?)?"
+ "((?:(?:[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}\\.)+" // named host
+ "(?:" // plus top level domain
+ "(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])"
+ "|(?:biz|b[abdefghijmnorstvwyz])"
+ "|(?:cat|com|coop|c[acdfghiklmnoruvxyz])"
const vw = (coef) => window.innerWidth * (coef/100);
const vh = (coef) => window.innerHeight * (coef/100);
@anton-chernianu
anton-chernianu / base.scss
Last active September 11, 2018 13:06
SCSS media mixin
#sidebar {
float: left;
width: 300px;
@include respond-to(tablet-p) { float: none; }
@include respond-to(tablet-l) { float: none; }
@include respond-to(mobile-p) { width: 240px; }
}
@anton-chernianu
anton-chernianu / 0_selector_hacks.scss
Created September 11, 2018 12:49 — forked from chriseppstein/0_selector_hacks.scss
This gist demonstrates some uses of the new sass feature: Passing content blocks to mixins.
@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}
@anton-chernianu
anton-chernianu / media-query.css
Created September 2, 2018 19:47 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@anton-chernianu
anton-chernianu / javascript
Created August 16, 2018 09:53
REGEX - Range of digits / date 1900-2018
regex: [/^(190[0-9]|19[1-9][0-9]|200[0-9]|201[0-8])+$/i]
@anton-chernianu
anton-chernianu / gist:67b96b87f14337c2a4d2ff33e87deb3c
Last active August 1, 2018 07:59
DAY, MONTH, YEAR Array for Select
export default {
daysNum: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],
daysString: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"],
monthRU: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
monthEng: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
yearNum: [1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 196