Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
undefined

Marco Guaspari Worms MarcoWorms

:shipit:
undefined
View GitHub Profile
View hsl-cheatsheet.md

Images are from https://www.refactoringui.com/ book

Hue is measured in degrees

  • 0° is red
  • 120° is green
  • 240° is blue.

hue examples

Saturation is how colorful or vivid a color looks

View example.sol
/**
* @notice Determine whether or not a given target and calldata is valid
* @dev In order to be valid, target and calldata must pass the allowlist conditions tests
* @param targetAddress The target address of the method call
* @param data The raw calldata of the call
* @return isValid True if valid, false if not
*/
function validateCalldataByOrigin(
string memory originName,
View example.json
{
"id": "TOKEN_APPROVE_VAULT",
"implementationId": "IMPLEMENTATION_YEARN_VAULTS",
"methodName": "approve",
"paramTypes": ["address", "uint256"],
"requirements": [
["target", "isVaultUnderlyingToken"],
["param", "isVault", "0"]
]
}
View shitcoin.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract MyToken is ERC20, Ownable {
constructor() ERC20("Weed", "WEED") {
_mint(0xCA88C5D43Bb11eDBcBC1436fEFA9d578d8D64489, 420 * 10 ** decimals());
}
@MarcoWorms
MarcoWorms / ftm.md
Last active October 19, 2021 19:53
Buying $FTM to use Fantom Opera network services
View ftm.md

Buying FTM

  1. If you have no other cryptos yet create and account at an exchange, for buying FTM we recommend Binance - Same link without referal code because it integrates the Fantom Opera network (the main fantom network)

  2. After creating an account at an exchange, deposit FIAT money (that's crypto lingo for paper money) into your exchange balance

  3. Once you have deposited funds you can either purchase FTM directly from a market or use the binance automatic converter.

Installing a browser wallet

View shufflin.js
const seed = 1234
const shuffledDeck = shuffle(seed, deck)
View shuffle.js
const { pipe, sortBy, prop, pluck } = require('ramda')
const shuffle = (seed, deck) => {
const routine = pipe(
deck => deck.map((card, index) => ({
rank: seededRandom(seed + index),
card,
})),
sortBy(prop('rank')),
pluck('card')
View seeded-random.js
const seededRandom = seed => Math.abs(Math.sin(seed))
View fiddling.js
// http://ramdajs.com/docs/#pipe
const { pipe, curry } = require('ramda')
const addToTop = curry((card, deck) => [card, ...deck])
const addToBottom = curry((card, deck) => [...deck, card])
const addBoth = pipe(
addToTop({ name: 'Ice Wall', damage: 3, cost: 1 }),
addToBottom({ name: 'Earth Strike', damage: 6, cost: 3 })