Skip to content

Instantly share code, notes, and snippets.

View josefrichter's full-sized avatar

Josef Richter josefrichter

View GitHub Profile
@josefrichter
josefrichter / contracts...MuyContract5.sol
Created September 9, 2021 17:32
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract ERC20Token {
string public name;
mapping(address => uint256) public balances;
function mint() public {
balances[tx.origin] ++;
}
}
@josefrichter
josefrichter / contracts...MyContract5b.sol
Created September 9, 2021 17:32
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract ERC20Token {
string public name;
mapping(address => uint256) public balances;
constructor(string memory _name) {
name = _name;
}
@josefrichter
josefrichter / contracts...MyContract6.sol
Created September 9, 2021 17:32
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
import "./SafeMath.sol";
// import "./Math.sol";
// library Math {
// function divide(uint256 a, uint256 b) internal pure returns (uint256) {
// require(b > 0);
// uint256 c = a / b;
@josefrichter
josefrichter / contracts...Escrow.sol
Created September 9, 2021 17:30
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract Escrow {
address agent; // nobody else can use this contract
mapping(address => uint256) public deposits;
modifier onlyAgent() {
require(msg.sender == agent);
@josefrichter
josefrichter / .git...HEAD
Created September 9, 2021 17:29
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&runs=200&gist=
ref: refs/heads/main
const data = Data({
ch1page: 1,
ch2page: 1,
ch3page: 1,
})
const ch1times = [1000, 1100, 1200, 1300]
const ch2times = [1000, 1015, 1100, 1130]
const ch3times = [1000, 1015, 1030, 1130]

Keybase proof

I hereby claim:

  • I am josefrichter on github.
  • I am josefrichter (https://keybase.io/josefrichter) on keybase.
  • I have a public key ASAYoMYvFMXARyy3y1bGYvjWElSi1FoiDldsDpYkMy0R4Qo

To claim this, I am signing this object:

(defmodule nova-rest.controllers.pet
(export
(manage 1)))
(defun manage
;;
;; GET Handler (Index)
;;
([(map 'req (map 'method #"GET"))]
import * as React from "react";
import { useState, useEffect } from "react";
/**
A hook to simply use state between components
Usage:
// You can put this in an central file and import it too
const useStore = createStore({ count: 0 })
defmodule QueueAgent do
def start_link(queue, name) do
Agent.start_link(fn -> queue end, name: name)
end
def add(queue, item) do
Agent.cast(queue, fn(state) -> state ++ [item] end)
end
def get(queue) do