Skip to content

Instantly share code, notes, and snippets.

View code-brewer's full-sized avatar

wangyouhua code-brewer

View GitHub Profile
@code-brewer
code-brewer / gist:e62487e88d2b51314453867a3f72315f
Created March 16, 2018 06:31 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@code-brewer
code-brewer / ballot.sol
Created September 28, 2018 03:08
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=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity 0.4.25;
/*数组类型Demo*/
contract DemoTypes303 {
/*String数组例子*/
string[] strArr;
function add(string str) public {
strArr.push(str);
}
function getStrAt(uint n) public constant returns (string s){
string storage tmp = strArr[n];
@code-brewer
code-brewer / ballot.sol
Created September 28, 2018 03:08
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=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity 0.4.25;
/*数组类型Demo*/
contract DemoTypes303 {
/*String数组例子*/
string[] strArr;
function add(string str) public {
strArr.push(str);
}
function getStrAt(uint n) public constant returns (string s){
string storage tmp = strArr[n];
@code-brewer
code-brewer / EventTest.sol
Created September 28, 2018 11:37
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=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity ^0.4.25;
contract SimpleStorage {
uint public data;
// event SetX(address indexed _from, uint value);
event Set(string label, uint value);
function set(uint x) public {
data = x;
// emit SetX(msg.sender, x);
// emit Set("#####", x);
}
@code-brewer
code-brewer / EventTest.sol
Created September 29, 2018 02:25
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=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity ^0.4.25;
contract SimpleStorage {
uint public data;
// event SetX(address indexed _from, uint value);
event Set(string label, uint value);
function set(uint x) public {
data = x;
// emit SetX(msg.sender, x);
// emit Set("#####", x);
}
@code-brewer
code-brewer / EventTest.sol
Created September 30, 2018 09:36
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=soljson-v0.4.25+commit.59dbf8f1.js&optimize=true&gist=
pragma solidity ^0.4.25;
contract SimpleStorage {
uint public data;
// event SetX(address indexed _from, uint value);
event Set(string label, uint value);
function set(uint x) public {
data = x;
// emit SetX(msg.sender, x);
// emit Set("#####", x);
}
@code-brewer
code-brewer / EventTest.sol
Created October 12, 2018 02:34
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=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity ^0.4.25;
contract SimpleStorage {
uint public data;
// event SetX(address indexed _from, uint value);
event Set(string label, uint value);
function set(uint x) public {
data = x;
// emit SetX(msg.sender, x);
// emit Set("#####", x);
}
@code-brewer
code-brewer / EventTest.sol
Created October 12, 2018 02:50
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=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity ^0.4.25;
contract SimpleStorage {
uint public data;
// event SetX(address indexed _from, uint value);
event Set(string label, uint value);
function set(uint x) public {
data = x;
// emit SetX(msg.sender, x);
// emit Set("#####", x);
}
@code-brewer
code-brewer / ByteStringOp.sol
Created October 12, 2018 08:49
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=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity 0.4.25;
contract stringOpTest {
byte[] bs;
function convertingToString()public returns(string){
// bytes32 memory hw = "Hello World"; // TypeError: Storage location can only be given for array or struct types.
bytes32 hw = "Hello World"; //
@code-brewer
code-brewer / ByteStringOp.sol
Created October 12, 2018 09:49
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=soljson-v0.4.25+commit.59dbf8f1.js&optimize=true&gist=
pragma solidity 0.4.25;
contract stringOpTest {
byte[] bs;
function convertingToString()public returns(string){
// bytes32 memory hw = "Hello World"; // TypeError: Storage location can only be given for array or struct types.
bytes32 hw = "Hello World"; //