Skip to content

Instantly share code, notes, and snippets.

View sharmaabhinav's full-sized avatar
😀
Working

ABHINAV SHARMA sharmaabhinav

😀
Working
  • Bangalore
View GitHub Profile
// 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);
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),
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);
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;
import './styles.css';
/**
*
* performance issues
*/
const mountPoint = document.getElementById('root')
Find an element in the list of user objects based on Id
const list = [
{
Id: 1,
Name: “A”
},
{
Id: 2,
Name: “B”
@sharmaabhinav
sharmaabhinav / api.js
Created March 7, 2021 06:35
Sample APIs problems
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)
GET /_cluster/health
GET /_cat/shards?v
GET /_cat/nodes?v
DELETE /pages
GET /_cat/indices?v
PUT /products
{
"settings": {
"number_of_shards": 2,
var compare = function (obj1, obj2) {
if (obj1 === obj2) {
return true
}
var keyMap = {}
var obj1Keys = Object.keys(obj1)
var obj2Keys = Object.keys(obj2)
@sharmaabhinav
sharmaabhinav / LodashFunctions.js
Last active January 28, 2019 11:01
This Gist implements functions from lodash
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