Skip to content

Instantly share code, notes, and snippets.

View rousnay's full-sized avatar
📡
Searching for new horizon

Mozahidur Rahman rousnay

📡
Searching for new horizon
View GitHub Profile
@rousnay
rousnay / css-variable-fallback
Created June 1, 2023 00:16
css fallback with variables
.mytext{
--tintColor: aqua;
--tintColor2: coral;
--tintColor3: #611fec;
color: var(--tintColor, var(--tintColor2, var(--tintColor3, white)));
}
const fileInput = document.querySelectorAll('input[type="file"]');
console.log(fileInput);
fileInput.forEach((element, index)=>{
let newNode = document.createElement('span');
newNode.classList.add("file-custom");
element.after(newNode);
})
@rousnay
rousnay / node-fetch
Last active February 17, 2023 20:33
node-fetch
import fetch from "node-fetch";
const token = "acKiCCMLQd9xneDTEcbFz6UZijEccu6cqoULHlX9WjrTLufj2pOzMs6LuzEVI...............";
const client_id = "196c0bbc-4696-49ed-......";
const body = JSON.stringify({
treatmentId: 6257,
type: "NEW",
});
const response = await fetch(
@rousnay
rousnay / ContextCmder-Disable.reg
Created February 9, 2023 08:34 — forked from jojobyte/ContextCmder-Disable.reg
Cmder Context (Right-Click) Menu for Windows 7, 8, 10 & 11
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder]
@rousnay
rousnay / skip undefine when waiting for async result
Last active November 26, 2022 01:50
skip undefined value when calling async function
const [feeds, setFeeds] = useState();
const [resolved, isResolved] = useState(false);
useEffect(() => {
(async () => {
const url = `https://hub.dummyapis.com/delay?seconds=5`;
const data = await fetch(url).then((res) => res.text());
setFeeds(data);
isResolved(true);
console.log("Run after completion of async");
@rousnay
rousnay / check_element_add_value
Last active October 24, 2022 08:46
check_element_add_value
const cfEmail = document.getElementById("cf-email");
if (cfEmail) {
cfEmail.value = customer_email;
}
@rousnay
rousnay / dob_validation
Created October 24, 2022 08:45
date_of_birth_validation
(function(){
var dateField = document.getElementById("cf-dob");
jQuery("#cf-dob").on("focusout", function () {
var match = dateField.value.split("-");
var c_dobyear = match[0];
var c_dobmonth = match[1];
var c_dobdate = match[2];
var age = 18;
var mydate = new Date();
@rousnay
rousnay / cookie
Created October 24, 2022 08:44
cookie
@rousnay
rousnay / sorting
Last active September 27, 2022 08:54
sorting
const sortedCommentArray = commentArray.sort((a, b) =>
a.createdAt > b.createdAt ? 1 : b.createdAt > a.createdAt ? -1 : 0
);
@rousnay
rousnay / add new property with value in existing object
Last active September 23, 2022 14:50
add new property with value in existing object
Object.assign(trackItem, {
commentArray: resComment.data.commentArray,
});