Skip to content

Instantly share code, notes, and snippets.

View umanda's full-sized avatar
🎯
Focusing

Umanda Jayobandara umanda

🎯
Focusing
View GitHub Profile
@umanda
umanda / EloquentCheatSheet.md
Created March 27, 2023 09:41 — forked from avataru/EloquentCheatSheet.md
Eloquent relationships cheat sheet
@umanda
umanda / php-pools.md
Created February 3, 2022 19:28 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@umanda
umanda / clamping-number.js
Created August 19, 2021 13:24
clamping number
function clamp(value, min, max) {
return min < max
? (value < min ? min : value > max ? max : value)
: (value < max ? max : value > min ? min : value)
}
//https://css-tricks.com/snippets/sass/clamping-number/
@umanda
umanda / advance.sass
Created May 27, 2020 11:00
Advanced SASS
$counter: 3;
$color : red;
$color-odd : 'odd';
$color-even :'even';
@function randomNum($min, $max) {
$rand: random();
$randomNum: $min + floor($rand * (($max - $min) + 1));
@return $randomNum;
}
@umanda
umanda / siblings.html
Last active May 26, 2020 10:03
Styling elements based on number of siblings
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
ul {
padding: 0;
}
@umanda
umanda / obj.js
Created May 20, 2020 13:43
jquery chaining
var obj = { // every method returns obj---------v
first: function() { console.log('first'); return obj; },
second: function() { console.log('second'); return obj; },
third: function() { console.log('third'); return obj; }
}
obj.first().second().third();
@umanda
umanda / file
Created April 28, 2020 12:55
Google translator on google sheet
=GOOGLETRANSLATE(A319,"en", "fr")
@umanda
umanda / colors.sh
Created April 19, 2020 06:56
Colors In Terminal
for code in {30..37}; do \
echo -en "\e[${code}m"'\\e['"$code"'m'"\e[0m"; \
echo -en " \e[$code;1m"'\\e['"$code"';1m'"\e[0m"; \
echo -en " \e[$code;3m"'\\e['"$code"';3m'"\e[0m"; \
echo -en " \e[$code;4m"'\\e['"$code"';4m'"\e[0m"; \
echo -e " \e[$((code+60))m"'\\e['"$((code+60))"'m'"\e[0m"; \
done
for code in {0..255}
do echo -e "\e[38;5;${code}m"'\\e[38;5;'"$code"m"\e[0m"
@umanda
umanda / color-print.py
Created April 19, 2020 06:50
print colored text and background
def prRed(skk): return ("\033[91m {}\033[00m" .format(skk))
def prGreen(skk): return ("\033[92m {}\033[00m" .format(skk))
def prYellow(skk): return("\033[93m {}\033[00m" .format(skk))
def prLightPurple(skk): return("\033[94m {}\033[00m" .format(skk))
def prPurple(skk): return("\033[95m {}\033[00m" .format(skk))
def prCyan(skk): return("\033[96m {}\033[00m" .format(skk))
def prLightGray(skk): return("\033[97m {}\033[00m" .format(skk))
def prBlack(skk): return("\033[98m {}\033[00m" .format(skk))
print(prYellow("Hellow World ")
@umanda
umanda / get_all_children_of_parent.sql
Last active March 31, 2020 06:18
Get all children of parent recursively in PostgreSQL
--- Table
-- DROP SEQUENCE public.data_id_seq;
CREATE SEQUENCE "data_id_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;