Skip to content

Instantly share code, notes, and snippets.

View korrio's full-sized avatar
👽

kOrriO korrio

👽
  • Hal Finney Co.,Ltd.
  • mempool
  • X @korrio
View GitHub Profile
@Chmarusso
Chmarusso / DamnSimpleNftStake.sol
Created February 13, 2022 15:54
Super Simple NFT staking
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol";
contract NftStaker {
IERC1155 public parentNFT;
struct Stake {
@Linch1
Linch1 / tokenPriceApi.js
Last active May 21, 2024 04:43
Retrive the price of any bsc token from it's address without using external service like poocoin/dextools
let pancakeSwapAbi = [
{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},
];
let tokenAbi = [
{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},
];
const Web3 = require('web3');
/*
Required Node.js
@korrio
korrio / ModSalary.sol
Created April 13, 2021 07:05
ModSalary.sol
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
async function run() {
const wait = ms => new Promise(resolve => setTimeout(resolve, ms))
const selector = 'div[aria-label="Toggle to follow"] div'
const nodes = [...document.querySelectorAll(selector)]
if (!nodes.length) return
for (let node of nodes) {
const text = node.parentElement.parentElement.parentElement.innerText
pragma solidity ^0.6.2;
pragma experimental ABIEncoderV2;
import {SafeMath} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.1/contracts/math/SafeMath.sol";
library BalanceManager {
using SafeMath for uint256;
// Storage
struct AccountBalance {
@akexorcist
akexorcist / buddhist-year.js
Last active April 25, 2024 10:20
MomentJS with Buddhist year
module.exports = {
toBuddhistYear: (moment, format) => {
var christianYear = moment.format('YYYY')
var buddhishYear = (parseInt(christianYear) + 543).toString()
return moment
.format(format.replace('YYYY', buddhishYear).replace('YY', buddhishYear.substring(2, 4)))
.replace(christianYear, buddhishYear)
}
}
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 23, 2024 15:25
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
const express = require('express');
const server = express();
const request = require('request');
const proxy = require('http-proxy-middleware');
server.set('view engine', 'ejs');
const createProxy = (path, target) =>
server.use(path, proxy({ target, changeOrigin: true, pathRewrite: {[`^${path}`]: ''} }));
@ultimagriever
ultimagriever / migrate.js
Created August 26, 2016 15:33
Migrate Mongo -> Firebase
/**
* Migrate MongoDB database to Firebase.
* Syntax: node migrate.js [-c || --collection=]<MongoDB Collection> [ [-h || --host=]<MongoDB URI>]
* If no args are provided, the MONGODB_URI
* env variable declared in the .env file
* will be used instead.
*/
const env = require('dotenv');
const firebase = require('firebase');

Most active GitHub users in Thailand

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 29 Jul 2015 01:52:41 GMT till Fri, 29 Jul 2016 01:52:41 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 6)