This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.13; | |
interface IDiamondCut { | |
enum FacetCutAction { | |
Add, | |
Replace, | |
Remove | |
} | |
// Add=0, Replace=1, Remove=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function readTextFile(file) { | |
var rawFile = new XMLHttpRequest(); | |
rawFile.open("GET", file, false); | |
rawFile.onreadystatechange = function () { | |
if(rawFile.readyState === 4) { | |
if(rawFile.status === 200 || rawFile.status == 0) { | |
var allText = rawFile.responseText; | |
doSomethingWithTheText(allText); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Tonejs Demo</title> | |
</head> | |
<body> | |
<!-- Learn music theory https://www.youtube.com/watch?v=rgaTLrZGlk0 --> |