Some introduction text, formatted in heading 2 style
This file contains 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
let lastScrollTop = window.scrollY; | |
const interval = setInterval(() => { | |
window.scrollBy(0, 10); | |
if (window.scrollY === lastScrollTop) { | |
clearInterval(interval); | |
const matchingElements = Array.from(document.querySelectorAll('*')).filter(element => Array.from(element.classList).some(className => className.includes('OrderHistory__OrderCardTitle-sc'))); | |
let total = 0 | |
matchingElements.forEach(item => { | |
let arr = item.innerHTML?.split(";") | |
total+= +(arr[arr.length -1].slice(1,item.length)) |
This file contains 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
import { readdir } from "fs/promises"; | |
import { resolve } from 'path'; | |
// provide the basepath you want to start your recursion from | |
export const getFiles = async (basePath) => { | |
const dirents = await readdir(basePath, { withFileTypes: true }); | |
const files = await Promise.all(dirents.map((dirent) => { | |
const res = resolve(basePath, dirent.name); | |
return dirent.isDirectory() ? getFiles(res) : res; | |
})); |
This file contains 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
const downloadLink = document.createElement("a"); | |
downloadLink.href = invoiceResponse.b64[0]; | |
downloadLink.download = "File_name"; | |
downloadLink.click(); |
This file contains 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
<div class="form-options"> | |
<input id="pincode" type="number" | |
onkeypress="validateNumberFields(event)" pattern="\d*" | |
oninput="this.value=this.value.replace(/[^0-9]/g,'');" | |
type="number" | |
maxlength="6" /> | |
</div> |
This file contains 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
// create a simple nextjs project | |
// Two initial states, you can have as many and import as required | |
export const counterState = 0; | |
export const sentenceState = ""; | |
// reducer that takes the state and the action paylod that determines which state to update | |
export const reducer = (state, action) => { // expects a current state and action to be worked on | |
switch (action.type) { |
This file contains 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
if exists(SELECT * from [dbo].[tbl_name] where id='my_id') | |
begin | |
update [dbo].[tbl_name] set column_name='${value}' where id='my_id' | |
end | |
else | |
begin | |
insert into [dbo].[tbl_name] values('val_1','val_2','val_3,...') | |
end |
This file contains 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
const data = { | |
'axis': {'amount': 4000000, 'roi': 14}, | |
'icici': {'amount': 7000000, 'roi': 13.2}, | |
'ubi': {'amount': 4900000, 'roi': 10}, | |
'idfc': {'amount': 3000000, 'roi': 13}, | |
'sbi': {'amount': 4000000, 'roi': 10.3}, | |
'bob': {'amount': 2000000, 'roi': 9}, | |
'bajaj': {'amount': 9000000, 'roi': 19}, | |
'avanse': {'amount': 4000000, 'roi': 12}, | |
'gd': {'amount': 4000000, 'roi': 15}, |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>FlexBox Table</title> | |
<link rel="stylesheet" href="./styles.css"> | |
</head> | |
<body> |
This file contains 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
export function parseUnixTimeStamp(unix_timestamp){ | |
var date = new Date(unix_timestamp); | |
// var hours = date.getHours(); | |
// var minutes = "0" + date.getMinutes(); | |
let parsedDate = date.toLocaleString([], {year: 'numeric', month: 'numeric', day: 'numeric',hour: '2-digit', minute:'2-digit'}) | |
// or | |
parsedDate = date.toLocaleString([], {year: 'numeric', month: 'short', day: 'short',hour: '2-digit', minute:'2-digit'}) | |
// or | |
parsedDate = date.toLocaleString([], {year: 'numeric', month: 'long', day: 'long',hour: '2-digit', minute:'2-digit'}) |
NewerOlder