Skip to content

Instantly share code, notes, and snippets.

View nichanank's full-sized avatar
🎯

Nichanan Kesonpat nichanank

🎯
View GitHub Profile
Verifying my Blockstack ID is secured with the address 1MvNohQLBnhNTH8e5qPy9kp3Ub964tGdWM https://explorer.blockstack.org/address/1MvNohQLBnhNTH8e5qPy9kp3Ub964tGdWM
@nichanank
nichanank / Person.sol
Created June 13, 2018 16:16
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.0;
contract PersonContract {
struct Person {
string name;
uint age;
}
Person[] people;
@nichanank
nichanank / keybase.md
Created July 15, 2018 06:24
keybase-github-authentication

Keybase proof

I hereby claim:

  • I am nichanank on github.
  • I am nich (https://keybase.io/nich) on keybase.
  • I have a public key whose fingerprint is 0DCD C9EC 68D4 EB9A 5F48 AE64 EDD7 6DC8 CE3B 7879

To claim this, I am signing this object:

This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:muport:Qmbm2Kef3nXtvmRTM7cmSgWgqJJH5fZqKyYPaPTiKD1Nkv ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
Verifying my Blockstack ID is secured with the address 1DLPSS7WKuZpBHLJpJE43qbhGvYgqPBT4m https://explorer.blockstack.org/address/1DLPSS7WKuZpBHLJpJE43qbhGvYgqPBT4m
@nichanank
nichanank / cash-register.js
Last active April 6, 2020 14:36
cash-register.js
// from FCC
function checkCashRegister(price, cash, cid) {
const totalCash = cid.reduce((total, value) => {
return total + value[1]
}, 0)
var units = [
0.01,
0.05,
0.1,
// from FCC
function sumPrimes(num) {
var numberList = []
for (var i = 2; i <= num; i++) {
numberList.push(i)
}
let nonPrimes = []
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreibn3rl2n2q5drt7pnphd3r443vgxj3hbliora4vfzqpnbns3orhj4 ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
@nichanank
nichanank / sablier-tutorial-connectors.js
Last active June 28, 2021 10:36
Barebones gists for Sablier dapp tutorial
import { InjectedConnector } from "@web3-react/injected-connector";
export const injected = new InjectedConnector({
supportedChainIds: [1, 3, 4, 5, 42]
});
@nichanank
nichanank / sablier-contract-call.js
Last active May 4, 2020 07:34
Creating a payment stream with Sablier
// yarn add bignumber.js
// import BigNumber from 'bignumber.js'
// BigNumber.config({ EXPONENTIAL_AT: 30 }) <--- add this after your imports, it will prevent the number from being formatted like "1e+21"
// call this when the user presses the "Create Stream" button
const sablier = new ethers.Contract(addresses[chainId].sablier, abis.sablier, getProviderOrSigner(library, account))
let convertedStartTime = Math.round(startTime.getTime() / 1000)
let convertedStopTime = Math.round(stopTime.getTime() / 1000)
let convertedDeposit = new BigNumber(deposit).multipliedBy(10 ** 18).toFixed(0)