Skip to content

Instantly share code, notes, and snippets.

@z0r0z
z0r0z / FlashPot.sol
Last active January 10, 2024 03:26
flash-lendable ETH wrapper with elastic shares
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.4;
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
/*///////////////////////////////////////////////////////////////
{
"GUPPY":{
"mint":"guppyrZyEX9iTPSu92pi8T71Zka7xd6PrsTJrXRW6u1"
},
"WHALE":{
"mint":"whaLeHav12EhGK19u6kKbLRwC9E1EATGnm6MWbBCcUW"
},
"KILLER WHALE":{
"mint":"kLwhLkZRt6CadPHRBsgfhRCKXX426WMBnhoGozTduvk"
},
@seeliang
seeliang / lint-only-changed-files.MD
Last active December 2, 2024 05:08
How to lint only changed files?

find out the differences

use git diff to generate file list

git diff --name-only master

limited to certain file types

add ext filter

/* eslint-disable react/no-multi-comp, react/no-unused-state */
import React from 'react'
import { connect } from 'react-redux'
import * as ReactAdmin from 'react-admin'
import { createSelector } from 'reselect'
import { Field, arrayRemove, arrayPush } from 'redux-form'
import { CircularProgress } from 'material-ui/Progress'
import Table, {
TableBody,
TableCell,

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at [email protected] or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

@raineorshine
raineorshine / sendRawTransaction.js
Last active December 3, 2022 18:02
Sends a raw transaction with web3 v1.2.2, ethereumjs-tx v2.1.1, and Infura
const Web3 = require('web3')
const Tx = require('ethereumjs-tx').Transaction
// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/INFURA_KEY'))
// the address that will send the test transaction
const addressFrom = '0x1889EF49cDBaad420EB4D6f04066CA4093088Bbd'
const privateKey = new Buffer('PRIVATE_KEY', 'hex')
@aalavandhan
aalavandhan / upsert.rb
Last active October 14, 2020 01:36
Rails Upsert
module ActiveRecordExtension
extend ActiveSupport::Concern
def self.upsert(attributes)
begin
create(attributes)
rescue ActiveRecord::RecordNotUnique, PG::UniqueViolation => e
find_by_primary_key(attributes['primary_key']).
update(attributes)
end