Skip to content

Instantly share code, notes, and snippets.

View koolamusic's full-sized avatar
🎯
Focusing

BLS12-381 koolamusic

🎯
Focusing
View GitHub Profile
@koolamusic
koolamusic / signature.html
Created September 30, 2022 01:11
Email signature personal
<table role="presentation" style="border: medium none; margin: 0px; border-collapse: collapse; width: 100%; max-width: 620px;"><tbody><tr><td style="vertical-align: top; padding-right: 8px; padding-bottom: 0px; width: 50px;"><table role="presentation" class="wrapper" style="border: medium none; margin: 0px; border-collapse: collapse; width: 100%; max-width: 620px;"><tbody><tr><td><table role="presentation" style="border: medium none; margin: 0px; border-collapse: collapse; width: 100%; max-width: 620px;"><tbody><tr><td><div style="width: 40px; height: 40px;"><a href="https://peerlist.io/0xalzzy" style="text-decoration: none;" target="_blank" rel="noreferrer" title="Andrew"><img src="https://lh3.googleusercontent.com/a-/AOh14Ghb_hvoLImrbLxOK5VwNOJ369hSY8EKOdNVupOW=s96-c" alt="Andrew" style="width: 100%; height: 100%; border-radius: 20px; flex-shrink: 0;"></a></div></td></tr></tbody></table></td></tr></tbody></table></td><td><table role="presentation" style="border: medium none; margin: 0px; border-collapse: co
@koolamusic
koolamusic / .block
Created August 12, 2022 17:18 — forked from mbostock/.block
Lab and HCL Color Spaces
license: gpl-3.0
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import { TransferHelper } from "./libraries/TransferHelper.sol";
import { FinderInterface } from "./interfaces/FinderInterface.sol";
import { IConditionalTokens } from "./interfaces/IConditionalTokens.sol";
@koolamusic
koolamusic / IDiamonCut.sol
Created July 30, 2022 21:41
A sample implementation of the solidity Diamond pattern used in this DeFi app https://louper.dev/diamond/0x362fA9D0bCa5D19f743Db50738345ce2b40eC99f
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
interface IDiamondCut {
enum FacetCutAction {
Add,
Replace,
Remove
}
// Add=0, Replace=1, Remove=2
const { NotFound } = require('http-errors');
const { ForbiddenError } = require('@casl/ability');
const Comment = require('./model')();
async function findAll(req, res) {
const comments = await Comment.accessibleBy(req.ability);
res.send({ items: comments });
}
@koolamusic
koolamusic / DateFormatDirective.ts
Created July 15, 2022 10:09
GraphQL directives to work with Nestjs
import { SchemaDirectiveVisitor } from '@graphql-tools/utils';
import { defaultFieldResolver, GraphQLField, GraphQLString } from 'graphql';
import formatDate from 'dateformat';
export class DateFormatDirective extends SchemaDirectiveVisitor {
visitFieldDefinition(field: GraphQLField<any, any>) {
const { resolve = defaultFieldResolver } = field;
const { defaultFormat } = this.args;
field.args.push({
deprecationReason: undefined,
```ts
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/**
* Hello fellow Nerd,
* In this smart contract we have taken every measure possible to
* keep the costs of gas managable every step along the way. Gas during The Accidental Apocalypse
* is hard to find -- You can't be pourin' it out on the ground like it grows on trees.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
contract MerkleTreeExample {
// --- PROPERTIES ---- //
// Calculated from `merkle_tree.js`
bytes32 public merkleRoot =
@koolamusic
koolamusic / addRPCNetworkEthers.js
Created February 18, 2022 13:34
Add an RPC EVM Supported Network to Metamask
/** @see https://docs.metamask.io/guide/rpc-api.html#other-rpc-methods*/
async function changeNetwork(){
await ethereum.request({ method: 'wallet_addEthereumChain',
params:[
{chainId: "IN_HEXADECIMAL_FORM",
chainName: "CHAIN_NAME",
nativeCurrency: {
name: "NATIVE_CURRENCY_NAME",
symbol: "NATIVE_CURRENCY_SYMBOL",
decimals: NATIVE_CURRENCY_DECIMALS //In number form
@koolamusic
koolamusic / Scroll.jsx
Last active February 12, 2022 20:32
Horizontal Scroll
const HorizontalScroll = styled.div`
position: relative;
overflow: hidden;
--offset: 20vw;
--move-initial: calc(-25% + var(--offset));
--move-final: calc(-50% + var(--offset));
div {
width: fit-content;
display: flex;