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
| // refer https://medium.com/coinmonks/journey-from-key-to-bitcoin-address-mainnet-and-testnet-variations-edb7c9d69665 | |
| const crypto = require('crypto'); | |
| const bs58check = require('bs58check') | |
| function generateCompressedPublicKey(x, y) { | |
| // Convert x and y from hexadecimal to BigInt | |
| const xBigInt = BigInt('0x' + x); | |
| const yBigInt = BigInt('0x' + y); |
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
| const s = " abhinav sharma. " | |
| console.log( | |
| s.at(0), | |
| s.charAt(0), | |
| s.charCodeAt(0), | |
| s.startsWith("abhi"), | |
| s.concat("defghi"), | |
| s.endsWith("rma"), | |
| String.fromCharCode(98), |
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
| import React, { useState, useRef, useEffect } from 'react'; | |
| const formattedTime = (time) => { | |
| const paddedMin = String(Math.floor(time / 60)).padStart(2, '0'); | |
| const paddedSec = String(time % 60).padStart(2, '0'); | |
| return `${paddedMin}:${paddedSec}`; | |
| }; | |
| function Solution() { | |
| const [time, setTime] = useState(0); |
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
| body { | |
| font-family: sans-serif; | |
| } | |
| .progress-container { | |
| background-color: rgb(233, 236, 239); | |
| border: 1px solid #c5c5c5; | |
| border-radius: 8px; | |
| height: 20px; | |
| overflow-x: hidden; |
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
| import './styles.css'; | |
| /** | |
| * | |
| * performance issues | |
| */ | |
| const mountPoint = document.getElementById('root') |
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
| Find an element in the list of user objects based on Id | |
| const list = [ | |
| { | |
| Id: 1, | |
| Name: “A” | |
| }, | |
| { | |
| Id: 2, | |
| Name: “B” |
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
| Array map | |
| const arr = [2,3,4,5] | |
| arr.map((el) => 2 * el) | |
| Output = [4,6,8,10] | |
| String repeat | |
| const city = “ajmer” | |
| city.repeat(5) |
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
| GET /_cluster/health | |
| GET /_cat/shards?v | |
| GET /_cat/nodes?v | |
| DELETE /pages | |
| GET /_cat/indices?v | |
| PUT /products | |
| { | |
| "settings": { | |
| "number_of_shards": 2, |
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
| var compare = function (obj1, obj2) { | |
| if (obj1 === obj2) { | |
| return true | |
| } | |
| var keyMap = {} | |
| var obj1Keys = Object.keys(obj1) | |
| var obj2Keys = Object.keys(obj2) | |
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 multiply (a, b) { | |
| return a * b | |
| } | |
| /* | |
| Creates a function that is restricted to invoking func once. | |
| Repeat calls to the function return the value of the first invocation. | |
| The func is invoked with the this binding and arguments of the created function. | |
| */ | |
| function once (fn) { | |
| var cacheValue = null |
NewerOlder