Skip to content

Instantly share code, notes, and snippets.

View mattlockyer's full-sized avatar
💭
🥳

Matt Lockyer mattlockyer

💭
🥳
View GitHub Profile
@mattlockyer
mattlockyer / hellomarkettoken.js
Created June 6, 2018 17:59
Tests for HelloMarketToken smart contract example for Solidity tutorials
//jshint ignore: start
// contracts
const contracts = [
{ name: 'HelloMarketToken' }
];
contracts.forEach(c => c.artifact = artifacts.require('./' + c.name + '.sol'))
/**************************************
* Tests
@mattlockyer
mattlockyer / hellomarket.js
Created June 6, 2018 17:58
Tests for HelloMarket smart contract example for Solidity tutorials
//jshint ignore: start
// contracts
const contracts = [
{ name: 'HelloMarket' }
];
contracts.forEach(c => c.artifact = artifacts.require('./' + c.name + '.sol'))
/**************************************
* Tests
@mattlockyer
mattlockyer / HelloMarketToken.sol
Created June 6, 2018 17:56
HelloMarket smart contract example with a token for Solidity tutorials (not ERC-20 compliant)
//jshint ignore: start
pragma solidity ^0.4.21;
contract Owner {
address public owner;
modifier onlyOwner() {
require(msg.sender == owner);
@mattlockyer
mattlockyer / HelloMarket.sol
Created June 6, 2018 17:53
HelloMarket smart contract for Solidity workshops
//jshint ignore: start
pragma solidity ^0.4.21;
contract Owner {
address public owner;
modifier onlyOwner() {
require(msg.sender == owner);
@mattlockyer
mattlockyer / dd.md
Last active February 22, 2018 20:47
Decentralized Dictionary

Blockchain

A transactional database where the changes in state are made by updating the difference from A to B. The transactions are bundled into blocks and cryptographically hashed to produce a unique signature. Blocks are arranged forward in time with the hash of the previous block included in the next block, this prevents tampering. Merkle tree data structures are used to efficiently store transactions and compute the current state from the root of the blockchain. Typically what is computed is the balance of an account.

Blockchain Network

A network designed to update a blockchain database. Distributed and decentralized are not prerequisites. Allows for the creation and tokenization of digital scarcity through consensus, game theory or mechanism design. Allows for the individual ownership, exchange and administration of cryptographically secured assets.

Private Permissioned Blockchain Network

Network participants chosen by centralized entity, consortium or federation.

Public Permissioned Bloc

@mattlockyer
mattlockyer / web3-utils.js
Created September 28, 2017 19:42
Portable Web3 Utils. Depends on Truffle Contract.
const web3utils = (function() {
/**************************************
* Web3
**************************************/
const getWeb3 = (fallbackURL = 'http://localhost:8545', web3 = window.web3) => {
if (web3 !== undefined) {
web3 = new Web3(web3.currentProvider);
} else {
@mattlockyer
mattlockyer / gist:7de893299e5390c1b3179964095a1852
Created July 27, 2017 21:53
Test Address for Rinkerby Faucet
0xf1a11C42075F2d89aC2792B4D43E2d48457F311F
@mattlockyer
mattlockyer / package.json
Created July 6, 2017 18:25
package.json Boilerplate
{
"name": "",
"description": "",
"version": "0.0.0",
"private": true,
"author": "Matt Lockyer",
"homepage": "",
"contributors": [ "Matt Lockyer ([email protected])" ],
@mattlockyer
mattlockyer / table.js
Created May 9, 2017 21:12
React Component for Draggable Re-ordering of Columns in react-table
import React, { Component } from 'react';
import ReactTable, { ReactTableDefaults } from 'react-table';
//https://github.com/tannerlinsley/react-table
//https://react-table.js.org/
import 'react-table/react-table.css'
Object.assign(ReactTableDefaults, {
defaultPageSize: 10,
minRows: 3,
});
@mattlockyer
mattlockyer / client.js
Last active February 22, 2023 18:30
s3 upload as stream using req stream (extra info in request header)
const file = this.input.files[0];
//console.log(file);
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', (e) => {
console.log(e.target.response);
});
xhr.open('POST', host + 'fileuploadstream', true);
xhr.setRequestHeader('body', JSON.stringify({ id: 'somebucketfolderid', fn: file.name }));
xhr.send(file);