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 {
@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 9, 2024 22:33
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)
@gokulkrishh
gokulkrishh / media-query.css
Last active May 8, 2024 06:59
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */