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
https://luizhamilton29.medium.com/whitelist-553358559658 | |
https://medium.com/@PhABC/off-chain-whitelist-with-on-chain-verification-for-ethereum-smart-contracts-1563ca4b8f11 | |
https://steveng.medium.com/performing-merkle-airdrop-like-uniswap-85e43543a592 | |
https://solidity-by-example.org/signature/ | |
https://nftchance.medium.com/the-gas-efficient-way-of-building-and-launching-an-erc721-nft-project-for-2022-b3b1dac5f2e1 | |
https://gist.github.com/c0/6ba3098740cec64c9be34255c0614254 |
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
// Take a list of addresses from path-to-addresses.txt, create a merkle tree, and store it in example-tree.json | |
const fs = require('fs') | |
const { MerkleTree } = require('merkletreejs') | |
const keccak256 = require('keccak256') | |
const { createMerkleTree } = require('../utils/merkle') | |
const addresses = fs.readFileSync('path-to-addresses.txt').toString().split('\n') | |
const { leaves, tree, root } = createMerkleTree(addresses) |
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 { mind, body } from './me' | |
const OVER_STIMULUS_THRESHOLD = 0.33 | |
const UNDER_STIMULUS_THRESHOLD = 0.01 | |
mind.on('stimulus', () => { | |
if (mind.stimulusRate > OVER_STIMULUS_THRESHOLD) { | |
['walk','exercise','medidate','write'].rand().go() | |
} | |
if (mind.stimulusRate < UNDER_STIMULUS_THRESHOLD) { |
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
if ( req.http.accept-encoding == "gzip" && beresp.http.content-type ~ "^(text/html|application/x-javascript|text/css|application/javascript|text/javascript)" ) { | |
# Header rewrite Force GZIP : 10 | |
set beresp.gzip = true; | |
} | |
if ( beresp.http.content-type ~ "^(text/html|application/x-javascript|text/css|application/javascript|text/javascript)" ) { | |
# Header rewrite Vary Encoding : 10 | |
set beresp.http.Vary = beresp.http.Vary ",Accept-Encoding"; | |
} |
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
alias fp='g fetch -p && pull' | |
alias dev='git checkout dev; fp' | |
alias amend='git commit --amend --no-edit' | |
alias add='git add --patch' | |
alias intent='git add --intent-to-add .; add' | |
alias force-push='git push -f origin `branch-name`' |
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
class Bottles | |
attr_accessor :bottle_number_factory | |
def initialize(bottle_number_factory = BottleNumberFactory) | |
@bottle_number_factory = bottle_number_factory | |
end | |
def song | |
verses(99, 0) | |
end |
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
gem 'minitest', '~> 5.3' | |
require 'minitest/autorun' | |
require_relative '../lib/six_packs' | |
class SixPacksTest < Minitest::Test | |
attr_reader :six_packs | |
def setup | |
@six_packs = ::SixPacks.new | |
end |
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
class Bottles | |
def song | |
starting_bottle_number = 99 | |
ending_bottle_number = 0 | |
verses(starting_bottle_number, ending_bottle_number) | |
end | |
def verses(starting_bottle_number, ending_bottle_number) | |
starting_bottle_number.downto(ending_bottle_number).map do |bottle_number| | |
verse(bottle_number) |
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
require_relative 'bottles' | |
class SixPacks < Bottles | |
def container_name(quantity) | |
if quantity % 6 == 0 && quantity > 0 | |
quantity > 6 ? 'six packs' : 'six pack' | |
else | |
super | |
end | |
end |
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
require_relative 'bottles' | |
class SixPacks < Bottles | |
def verse(quantity) | |
if quantity % 6 == 0 && quantity == 6 | |
super.gsub("#{quantity} bottles", "#{(quantity / 6)} six pack") | |
elsif quantity % 6 == 0 | |
super.gsub("#{quantity} bottles", "#{(quantity / 6)} six packs") | |
else | |
super |
NewerOlder