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
pragma solidity ^0.8.0; | |
import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; | |
contract BudgetBreaker { | |
enum ContractState { NOT_EXECUTED, EXECUTORY, DISBURSED } | |
enum MemberState { DNE, NOT_SIGNED, SIGNED } | |
ContractState contractState = ContractState.NOT_EXECUTED; | |
mapping (address => MemberState) memberStates; |
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
type GeneratorFunction<T> = () => Generator<any, T, any> | |
export default function<T>(g: GeneratorFunction<T>): Promise<T> { | |
return new Promise((res, rej) => { | |
// create generator | |
const r = g() | |
function step(green: boolean, fulfilled: any) { | |
let result: IteratorResult<any, T> | null |
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 Usage { | |
data class UsageEventDetails(val type: Int, val time: Long) | |
private fun computeUsages(begin: Long, end: Long): Map<String, Long> { | |
val usageStatsManager = getSystemService(USAGE_STATS_SERVICE) as UsageStatsManager | |
val usageEvents = usageStatsManager.queryEvents(begin, end) | |
val usageEventsByPackage: MutableMap<String, MutableList<UsageEventDetails>> = HashMap() | |
val usageEvent = UsageEvents.Event() |
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
const store = (reducer, state) => { | |
return { | |
receive: action => { | |
state = reducer(state, action) | |
}, | |
state: () => state | |
} | |
} | |
const combine = structure => (state = {}, action) => { |
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
hw = hs.window | |
hw.animationDuration = 0 | |
hs.hotkey.bind('ctrl-alt', 'r', function() | |
hs.reload() | |
hs.notify.show('', '', 'Config Reloaded') | |
end) | |
function get_window() |
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
function removeSubfolders(folders) { | |
const tree = {} | |
for (let i = 0; i < folders.length; i++) { | |
const f = folders[i] | |
let node = tree | |
let name = '' | |
for (let j = 1; j < f.length; j++) { |
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
export default class Async { | |
result = null | |
finished = false | |
handlers = [] | |
constructor(f) { | |
if (f !== undefined) f(r => this.done(r)) | |
} | |
done(result) { |
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
// scraped from https://www.worldometers.info/coronavirus/ on May 19, 2020 | |
const deaths = [91981, 2722, 27709, 16853, 34796, 32007, 28239, 8123, 4171, 7057, 3164, 2789, 4634, 5842, 320, 9080, 5332, 478, 5694, 939, 15, 2799, 1886, 171, 3698, 1231, 22, 1547, 224, 349, 936, 535, 1191, 1120, 276, 286, 749, 592, 629, 118, 645, 434, 831, 263, 548, 231, 279, 297, 382, 233, 555, 12, 173, 99, 192, 113, 35, 300, 191, 217, 29, 25, 61, 174, 107, 127, 462, 140, 40, 56, 165, 146, 16, 13, 105, 26, 133, 110, 95, 28, 38, 79, 104, 10, 64, 41, 59, 61, 7, 21, 28, 104, 57, 11, 30, 18, 14, 4, 4, 46, 4, 19, 9, 31, 26, 17, 50, 55, 52, 10, 51, 11, 51, 7, 20, 7, 13, 12, 41, 9, 10, 6, 43, 21, 9, 53, 33, 21, NaN, 7, 15, 2, 2, 5, 2, 24, 10, 12, 3, NaN, 9, NaN, 1, NaN, 4, NaN, 7, 22, 1, 2, 14, 6, NaN, 13, NaN, NaN, 1, NaN, 20, 9, 10, NaN, 8, 3, 4, 11, 1, 7, 1, 4, 15, 3, 3, NaN, 3, 3, 4, NaN, 1, 3, NaN, 8, 3, 1, 1, NaN, NaN, NaN, NaN, 2, NaN, NaN, NaN, NaN, 1, NaN, NaN, NaN, NaN, 1, NaN, 1, 1, 1, NaN, NaN, 2, 1, NaN, NaN, NaN, NaN, NaN, Na |
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 qualified Prelude | |
import Prelude (String, Num (..), Eq (..), Int (..), show) | |
id :: a -> a | |
id x = x | |
const :: a -> b -> a | |
const x _ = x | |
($) :: (a -> b) -> a -> b |
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
let id = x => x; | |
let ($) = (f, x) => f(x); | |
let flip = f => (x, y) => f(y, x); | |
let const = (x, _) => x; | |
let (<<<) = (f, g) => x => f(g(x)); | |
let (>>>) = (f, g) => x => g(f(x)); | |
module type Functor = { | |
type f('a); | |
let fmap: ('a => 'b) => f('a) => f('b); |
NewerOlder