git clone --depth=1 <REPO_URL> appName
cd appName
rm -rf package-lock.json
function formatTimestamp(timestampInput) { | |
const timestamp = parseInt(timestampInput, 10); | |
if (isNaN(timestamp)) { | |
return 'Invalid timestamp'; | |
} | |
// Convert timestamp from seconds to milliseconds | |
const date = new Date(timestamp * 1000); | |
const options = { day: '2-digit', month: 'short', year: 'numeric' }; |
import React from 'react'; | |
const ExtensionInstaller = () => { | |
const handleDrop = (event) => { | |
event.preventDefault(); | |
const file = event.dataTransfer.files[0]; | |
if (file.name.endsWith('.crx') || file.name.endsWith('.zip')) { | |
const reader = new FileReader(); | |
reader.onload = (event) => { | |
const url = event.target.result; |
from PIL import Image | |
import pytesseract | |
# Load the image from file | |
img_path = '/mnt/data/image.png' | |
img = Image.open(img_path) | |
# Use tesseract to do OCR on the image | |
text = pytesseract.image_to_string(img) |
function binarySearchIterative(inputArray, searchTerm) { | |
let left = 0; | |
let right = inputArray.length - 1; | |
while(left <= right) { | |
const midPoint = Math.floor((left + right) / 2); | |
if (inputArray[midPoint] === searchTerm) { | |
return true; | |
} else if (searchTerm < inputArray[midPoint]) { |
function searchRecursive(inputArray, searchTerm, left, right) { | |
if (left > right) { | |
return false; | |
} | |
const midPoint = Math.floor((left + right) / 2); | |
if (inputArray[midPoint] === searchTerm) { | |
return true; | |
} else if (searchTerm < inputArray[midPoint]) { |
server { | |
ssi on; | |
proxy_intercept_errors on; | |
location /product-list { | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; |
// Group and sum the value. | |
function groupAndSum(list) { | |
const existingItems = {} | |
list.forEach((item) => { | |
if (!existingItems[item.name]) { | |
existingItems[item.name] = item; | |
return; | |
} | |
existingItems[item.name] = { |
/* | |
Validate if a given string can be interpreted as a decimal number. | |
Some examples: | |
"0" => true | |
" 0.1 " => true | |
"abc" => false | |
"1 a" => false | |
"2e10" => true | |
" -90e3 " => true |
// Stack - | |
// Push - Add value at end | |
// Pop - Remove and return the end of the stack | |
// Peek - Return the end value of the stack | |
// Size - Return the size | |
function Stack() { | |
let count = 0; | |
let storage = {}; |