Skip to content

Instantly share code, notes, and snippets.

View nichanank's full-sized avatar
🎯

Nichanan Kesonpat nichanank

🎯
View GitHub Profile
@nichanank
nichanank / bytebracket_adapted.py
Last active February 21, 2021 09:09
adapted version of bytebracket_scorer
"""
This is an adapted version of the original ByteBracket library https://gist.github.com/pursuingpareto/b15f1197d96b1a2bbc48 that was implemented to score a 63-game NCAA tournament
Whitepaper: https://drive.google.com/file/d/0BxHbbgrucCx2N1MxcnA1ZE1WQW8/view
"""
import random
def score(bracket, results, filt,
teams_remaining, blacklist, round_num=0):
"""
// this returns two arrays, one containing Streams where the user was the sender (senderStreams) and another in which the user was a recipient (recipientStreams)
const MY_STREAMS = gql`
query streams($account: String!) {
senderStreams:streams(where: {sender: $account}){
id
recipient
deposit
startTime
stopTime
@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)
@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]
});
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/
// from FCC
function sumPrimes(num) {
var numberList = []
for (var i = 2; i <= num; i++) {
numberList.push(i)
}
let nonPrimes = []
@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,
Verifying my Blockstack ID is secured with the address 1DLPSS7WKuZpBHLJpJE43qbhGvYgqPBT4m https://explorer.blockstack.org/address/1DLPSS7WKuZpBHLJpJE43qbhGvYgqPBT4m
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/
@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: