Skip to content

Instantly share code, notes, and snippets.

View niklabh's full-sized avatar

Nikhil Ranjan niklabh

View GitHub Profile

Keybase proof

I hereby claim:

  • I am niklabh on github.
  • I am niklabh (https://keybase.io/niklabh) on keybase.
  • I have a public key ASBw8Hg-aR56uIzgDloqIvUxjzxiY2w5UdyxfefQUx4o0Ao

To claim this, I am signing this object:

@niklabh
niklabh / quine.js
Created July 12, 2017 12:20
Quine in javascript
(function a(){console.log(`(${a}())`)}())
Verifying my Blockstack ID is secured with the address 19cweZcZVkg1C4suK7kXk6q2WWLmv6Wkkg https://explorer.blockstack.org/address/19cweZcZVkg1C4suK7kXk6q2WWLmv6Wkkg
Verifying my Blockstack ID is secured with the address 1NmTj3XDDuG49RJadM3kR6bMC8sbcWQE7i https://explorer.blockstack.org/address/1NmTj3XDDuG49RJadM3kR6bMC8sbcWQE7i
@niklabh
niklabh / objectToShema.js
Created September 12, 2019 13:28
Javascript Object to Open API schema
const pad = (num) => {
let pad = ""
for (let i = 0; i < num; i++) {
pad += " "
}
return pad
}
function recurse (a, type, num) {
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
contract ECDSA {
/**
* @dev Dummy implementation. This code is implemented in the precomiled contract
* @return A boolean confirming whether the public key is signer for the message.
*/
function verify(
bytes calldata public_key,
@niklabh
niklabh / docsig.md
Created September 8, 2023 11:51
docsig

± |main ✓| → docker compose up -d [+] Running 17/17 ✔ db 8 layers [⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 17.8s ✔ 44ba2882f8eb Pull complete 3.7s ✔ 08b8223d0cb6 Pull complete 3.7s ✔ ef2696fb09d6 Pull complete 3.9s ✔ 6ae32c298a0d Pull complete

// File: @openzeppelin/contracts/interfaces/draft-IERC6093.sol
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
@niklabh
niklabh / gist:dcdc1ac9bb34168d12255e6e744fd5ac
Last active May 5, 2024 23:02
Javascript code to draw an animated clock
// HTML
// <canvas id="canvas" width="400px" height="430px" >not support canvas</canvas>
// Javascript
const canvas = document.getElementById('canvas');
const w = canvas.width;
const h = canvas.height;
const ctx = canvas.getContext("2d");
ctx.lineWidth = 3;