Skip to content

Instantly share code, notes, and snippets.

View amacgregor's full-sized avatar
:shipit:
Working on Side Projects

Allan MacGregor amacgregor

:shipit:
Working on Side Projects
View GitHub Profile

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

pragma solidity ^0.4.18;
contract HeroToken {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/* Initializes contract with initial supply tokens to the creator of the contract */
function HeroToken(
uint256 initialSupply
) public {
// https://github.com/ethereum/EIPs/issues/20
contract ERC20 {
function totalSupply() constant returns (uint totalSupply);
function balanceOf(address _owner) constant returns (uint balance);
function transfer(address _to, uint _value) returns (bool success);
function transferFrom(address _from, address _to, uint _value) returns (bool success);
function approve(address _spender, uint _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint remaining);
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
@amacgregor
amacgregor / eth_hero5.sh
Created December 22, 2017 22:24
eth_hero5.sh
Geth
Version: 1.7.3-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9.2
Operating System: darwin
GOPATH=
GOROOT=/usr/local/Cellar/go/1.9.2/libexec
@amacgregor
amacgregor / eth_hero4.json
Created December 22, 2017 22:23
eth_hero4.json
{
"config": {
"chainId": 24,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000042",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
@amacgregor
amacgregor / eth_hero3.sh
Created December 22, 2017 22:22
eth_hero3.sh
WARN [12-22|15:32:55] No etherbase set and no accounts found as default
INFO [12-22|15:32:55] Allocated cache and file handles database=/Users/.../ethereum_0hero/TestNetData/geth/chaindata cache=16 handles=16
INFO [12-22|15:32:55] Writing custom genesis block
INFO [12-22|15:32:55] Successfully wrote genesis state database=chaindata hash=6231b0…a0300b
INFO [12-22|15:32:55] Allocated cache and file handles database=/Users/.../ethereum_0hero/TestNetData/geth/lightchaindata cache=16 handles=16
INFO [12-22|15:32:55] Writing custom genesis block
INFO [12-22|15:32:55] Successfully wrote genesis state database=lightchaindata hash=6231b0…a0300b
@amacgregor
amacgregor / eth_hero1.sh
Created December 22, 2017 22:22
eth_hero1.sh
WARN [12-22|16:10:27] No etherbase set and no accounts found as default
INFO [12-22|16:10:27] Starting peer-to-peer node instance=Geth/HeroNode1/v1.7.3-stable/darwin-amd64/go1.9.2
INFO [12-22|16:10:27] Allocated cache and file handles database=/Users/.../ethereum_0hero/TestNetData/geth/chaindata cache=128 handles=1024
INFO [12-22|16:10:27] Initialised chain configuration config="{ChainID: 24 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: 0 EIP158: 0 Byzantium: <nil> Engine: unknown}"
INFO [12-22|16:10:27] Disk storage enabled for ethash caches dir=/Users/.../ethereum_0hero/TestNetData/geth/ethash count=3
INFO [12-22|16:10:27] Disk storage enabled for ethash DAGs dir=/Users/.../.ethash count=2
INFO [12-22|16:10:27] Initialising Ethereum protocol versions="[63 62]" network=24
INFO [12-22|16:10:27] Loaded most recent local header number=0 hash=6231b0…a0300b td=1024
INFO [12-22|16:10:27] Loaded mo
@amacgregor
amacgregor / eth_hero2.sh
Created December 22, 2017 22:20
eth_hero2
INFO [12-22|17:07:55] Updated mining threads threads=0
INFO [12-22|17:07:55] Transaction pool price threshold updated price=18000000000
INFO [12-22|17:07:55] Starting mining operation
INFO [12-22|17:07:55] Commit new mining work number=1 txs=0 uncles=0 elapsed=981.307µs
INFO [12-22|17:07:57] Generating DAG in progress epoch=0 percentage=0 elapsed=577.592ms
INFO [12-22|17:07:57] Generating DAG in progress epoch=0 percentage=1 elapsed=1.168s
INFO [12-22|17:07:58] Generating DAG in progress epoch=0 percentage=2 elapsed=1.985s
INFO [12-22|17:07:59] Generating DAG in progress epoch=0 percentage=3 elapsed=2.586s
@amacgregor
amacgregor / multiple_inheritance_diamond.php
Last active March 1, 2017 07:35
Diamond problem in PHP, showcasing the problem of multiple inheritance
<?php
class Cat {
public function roar() { /** Do Something **/ }
}
class Tiger extends Cat {
public function roar() { /** Do Something Different **/ }
}