Skip to content

Instantly share code, notes, and snippets.

View MarcoWorms's full-sized avatar
:shipit:
undefined

Marco Guaspari Worms MarcoWorms

:shipit:
undefined
View GitHub Profile
@MarcoWorms
MarcoWorms / mini-redux.js
Last active August 7, 2023 19:06
Redux in a nutshell
function createStore (reducers) {
var state = reducers()
const store = {
dispatch: (action) => {
state = reducers(state, action)
},
getState: () => {
return state
}
}

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

/**
* @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,
{
"id": "TOKEN_APPROVE_VAULT",
"implementationId": "IMPLEMENTATION_YEARN_VAULTS",
"methodName": "approve",
"paramTypes": ["address", "uint256"],
"requirements": [
["target", "isVaultUnderlyingToken"],
["param", "isVault", "0"]
]
}
@MarcoWorms
MarcoWorms / autotinder.js
Last active April 23, 2022 15:18
Tinder Dislike Signos Persons
const Latinise={};Latinise.latin_map={"Á":"A","Ă":"A","Ắ":"A","Ặ":"A","Ằ":"A","Ẳ":"A","Ẵ":"A","Ǎ":"A","Â":"A","Ấ":"A","Ậ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ä":"A","Ǟ":"A","Ȧ":"A","Ǡ":"A","Ạ":"A","Ȁ":"A","À":"A","Ả":"A","Ȃ":"A","Ā":"A","Ą":"A","Å":"A","Ǻ":"A","Ḁ":"A","Ⱥ":"A","Ã":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ḃ":"B","Ḅ":"B","Ɓ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ć":"C","Č":"C","Ç":"C","Ḉ":"C","Ĉ":"C","Ċ":"C","Ƈ":"C","Ȼ":"C","Ď":"D","Ḑ":"D","Ḓ":"D","Ḋ":"D","Ḍ":"D","Ɗ":"D","Ḏ":"D","Dz":"D","Dž":"D","Đ":"D","Ƌ":"D","DZ":"DZ","DŽ":"DZ","É":"E","Ĕ":"E","Ě":"E","Ȩ":"E","Ḝ":"E","Ê":"E","Ế":"E","Ệ":"E","Ề":"E","Ể":"E","Ễ":"E","Ḙ":"E","Ë":"E","Ė":"E","Ẹ":"E","Ȅ":"E","È":"E","Ẻ":"E","Ȇ":"E","Ē":"E","Ḗ":"E","Ḕ":"E","Ę":"E","Ɇ":"E","Ẽ":"E","Ḛ":"E","Ꝫ":"ET","Ḟ":"F","Ƒ":"F","Ǵ":"G","Ğ":"G","Ǧ":"G","Ģ":"G","Ĝ":"G","Ġ":"G","Ɠ":"G","Ḡ":"G","Ǥ":"G","Ḫ":"H","Ȟ":"H","Ḩ":"H","Ĥ":"H","Ⱨ":"H","Ḧ":"H","Ḣ":"H","Ḥ":"H","Ħ":"H","Í":"I","Ĭ":"I","Ǐ":"I","Î":"I","Ï":"I","Ḯ":"I","İ":"I","Ị":"I","Ȉ":"I
// 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

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

window.setInterval(
() => document.querySelectorAll('.jobs-item.failed')
.forEach(build => {
console.log('Restarting build', build.querySelector('.job-env').textContent.trim(), (new Date()).toString())
build.querySelector('.action-button--restart').click()
}),
5000
)
@MarcoWorms
MarcoWorms / la-ramda.js
Created June 29, 2017 03:51 — forked from mrosata/la-ramda.js
A subset of the Ramda library written using arrow functions, "lamda-ramda". The purpose of this is fun and to use in environments where importing 3rd party libs isn't allowed. Feel free to add to this.
const R = new LaRamda()
/**
* A subset of custom implementations of functions from
* the Ramda library. (all in Lamda form)
* - thanks to @xgrommx for uniq, intersection, where, evolve,
* applySpec, defaultTo, both, either, cond, zipWith
*/
function LaRamda () {
const I = x => x