0x09cd18d17c48a9e5f7919dbb8267cbc0f9c75e95a3c94f9c4f910edaf90c2db6
This file contains hidden or 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 "@openzeppelin/contracts/utils/math/Math.sol"; | |
struct Accumulator { | |
uint concrete; | |
uint virtualRate; | |
uint virtualSince; | |
} |
This file contains hidden or 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 type { Subscriber } from 'svelte/store'; | |
export function store<T>(start: () => T, stop?: () => void) { | |
const subscribers = new Set<Subscriber<T>>(); | |
let value: T; | |
function notify() { | |
for (const fn of subscribers) { | |
fn(value); |
This file contains hidden or 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.4; | |
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; | |
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; | |
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol"; | |
contract MyTokenV1 is Initializable, ERC20Upgradeable { | |
function initialize() initializer public { | |
__ERC20_init("MyToken", "MTK"); |
This file contains hidden or 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; | |
// Unlike the string type, ShortString is a value type that can be made immutable. | |
// It supports strings of at most 32 bytes and assumes they don't contain null bytes. | |
type ShortString is bytes32; | |
error StringTooLong(string s); |
This file contains hidden or 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
type GraphGenerator<T> = Iterable<[T, T?]>; | |
interface Edges<T> { | |
pred: T[]; | |
succ: T[]; | |
} | |
export function toposort<T, G extends GraphGenerator<T>>(graph: G): T[] { | |
const sorted = new Set<T>(); | |
const nodes = new Map<T, Edges<T>>(); |
This file contains hidden or 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
$ node -r time-require -r solc-0.6.8 -e '' | |
Start time: (2020-07-02 16:09:07 UTC) [treshold=1%] | |
# module time % | |
1 ./soljson.js (node_modules/solc-0.6.8/soljson.js) 2.2s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 99% | |
2 solc-0.6.8 (node_modules/solc-0.6.8/index.js) 2.3s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 100% | |
Total require(): 26 | |
Total time: 2.3s | |
$ node -r time-require -r solc-0.6.9 -e '' |
This file contains hidden or 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 express = require('express'); | |
const methods = require('methods'); | |
function AsyncRouter(options) { | |
const router = express.Router(options); | |
Object.setPrototypeOf(router, AsyncRouter.prototype); | |
return router; | |
} | |
Object.setPrototypeOf(AsyncRouter.prototype, express.Router); |
This file contains hidden or 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
[Unit] | |
Description=Lock all consoles | |
Documentation=man:physlock(1) | |
Before=sleep.target | |
OnFailure=hibernate.target | |
[Service] | |
Type=forking | |
ExecStart=physlock -d |
This file contains hidden or 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
#!/usr/bin/env bash | |
set -o errexit -o pipefail | |
if [ "$#" -eq 0 ] | |
then | |
echo "usage: rs PATTERN REPLACEMENT [PATH...]" > /dev/stderr | |
exit 1 | |
fi |