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 ShiftWindowTranslate() { | |
const parentRef = useRef(null); | |
const [parentWidth, setParentWidth] = useState(0); | |
const shiftCSSTranslate = (px) => { | |
return { transform: `translateX(${parentWidth - px}px)` }; | |
}; | |
useEffect(() => { | |
const parent = parentRef.current; |
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 detectDevice(userAgent) { | |
const deviceInfo = { | |
platform: "Unknown", | |
device: "Unknown", | |
browser: "Unknown", | |
}; | |
if (/iPhone/.test(userAgent)) { | |
deviceInfo.platform = "📱 iOS"; | |
deviceInfo.device = "iPhone"; |
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 insertSpaces(input) { | |
const rawValue = input.value.replace(/\D/g, ''); | |
const formattedValue = rawValue.replace(/(.{4})/g, '$1 '); | |
input.value = formattedValue.trim(); | |
} |
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
# inline keyboard button and send photo | |
const keyboard = Markup.inlineKeyboard([ | |
[Markup.button.callback('first-value-column', 'first-key')], | |
[Markup.button.callback('second-value-column', 'second-key')], | |
[Markup.button.callback('first-value-row', 'first-key-row'), Markup.button.callback('second-value-row', 'second-key-row')], | |
]); | |
bot.telegram.sendMessage(chat_id, message, { | |
parse_mode: "HTML", | |
reply_markup: keyboard.reply_markup |
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
# insert spaces cardnumber | |
function insertSpaces(input) { | |
const rawValue = input.value.replace(/\D/g, ''); | |
const formattedValue = rawValue.replace(/(.{4})/g, '$1 '); | |
input.value = formattedValue.trim(); | |
} | |
# input keypress only number | |
<input onkeypress="const isNumber = /^[0-9]$/.test(event.key); if (!isNumber) { event.preventDefault(); return}" /> |
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
read -p "Enter path to ISO: " iso | |
read -p "disk: " disk | |
sudo dd if=$iso of=/dev/$disk conv=fsync bs=4M | |
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
read -p "disk: " disk | |
sudo dd if=/dev/zero of=/dev/$disk bs=1024k count=2048 |
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 debounce(func, timeout = 300){ | |
let timer; | |
return (...args) => { | |
clearTimeout(timer); | |
timer = setTimeout(() => { func.apply(this, args); }, timeout); | |
}; | |
} | |
function saveInput(){ | |
console.log('Saving data'); | |
} |
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 | |
filename="/etc/resolv.conf" | |
sudo chmod 777 $filename | |
echo -n "" > $filename | |
echo "#Generated by NetworkManager" | tee -a $filename | |
echo "nameserver 208.67.222.222" | tee -a $filename | |
echo "nameserver 208.67.220.220" | tee -a $filename | |
sudo chmod +x $filename |