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 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; |
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
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) |
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
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]) { |
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
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]) { |
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
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; |
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
// 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] = { |
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
/* | |
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 |
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
// 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 = {}; |
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 name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Bittitan</title> | |
</head> | |
<body> | |
<noscript> | |
You need to enable JavaScript to run this app. |
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
"use strict"; | |
const tree = { | |
left: null, | |
right: null, | |
parent: null, | |
value: '0', | |
}; | |
const node1 = { |
NewerOlder