This file contains hidden or 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
{ | |
"network-configs": { | |
"network-1": { | |
"version": "1.0", | |
"clients": { | |
"client-1": { | |
"tlsEnable": false, | |
"organization": "Org1MSP", | |
"channel": "mychannel", | |
"credentialStore": { |
This file contains hidden or 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
0xA970dcEa3F1EAa08B5225c71A9b11E456c56f9aE |
This file contains hidden or 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 Web3 = require("web3"); | |
const EthereumTransaction = require("ethereumjs-tx"); | |
const mainArtifact = requir("./build/contracts/Main.json"); | |
const OWNER_ADDRESS = "OWNER_ETHEREUM_ADDRESS"; | |
const PRIVATE_KEY = "PRIVATE_KEY_OF_OWNER_ETHEREUM_ADDRESS"; | |
const CONTRACT_ADDRESS = "MAIN_CONTRACT_ADDRESS"; | |
// Local (Ganache cli) or Infura API | |
const web3 = new Web3( |
This file contains hidden or 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 d3 = require('d3'); | |
(function() { | |
d3.layout.grid = function() { | |
var mode = "equal", | |
layout = _distributeEqually, | |
x = d3.scale.ordinal(), | |
y = d3.scale.ordinal(), | |
size = [1, 1], | |
actualSize = [0, 0], |
This file contains hidden or 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 Node() { | |
this.value = 5; | |
this.next = [object Object]; | |
} | |
function recurseNodes(num, node) { | |
if(node.next === null) return false; | |
if(node.value === num) return true; |
This file contains hidden or 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
/** | |
* returns every sequence of throws a single player could throw over a three-round game of rock-paper-scissors | |
* rockPaperScissors(1); -> [['rock'],['paper'],['scissors']] | |
* rockPaperScissors(2); -> | |
* [['rock','rock'],['rock','paper'],['rock','scissors'], | |
* ['paper','paper'],['paper','scissors'],['paper','rock'], | |
* ['scissors','scissors'],['scissors','paper'],['scissors','rock']] | |
*/ | |
function rockPaperScissors(num) { | |
var results = [], |
This file contains hidden or 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
/* | |
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation: | |
1p piece | |
2p piece | |
5p piece | |
10p piece | |
20p piece | |
50p piece |
This file contains hidden or 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 Node(data, leftChild, rightChild) { | |
this.data = data || null; | |
this.left = leftChild || null; | |
this.right = rightChild || null; | |
} | |
function Tree(rootNode) { | |
this.rootNode = null; | |
} |
This file contains hidden or 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
//stackoverflow filter method example | |
a = [5, 4, 3, 2, 1]; // array 5,4..1 | |
smallvalues = a.filter(function(x) { return x < 3 }); // [2, 1] return value | |
everyother = a.filter(function(x,i) { return i%2==0 }); // [5, 3, 1] return value | |
//The first one reads: »return me every element (x), which is lesser than 3«. The result is not astounding. | |
//The second one reads: »return me every element, whose index (i) is even (including 0)« |
This file contains hidden or 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 Shape(a, b) { | |
this.x = a; | |
this.y = b; | |
} | |
Shape.prototype.getPosition = function () { | |
return [this.x, this.y]; | |
}; | |
function Circle(a, b) { |
NewerOlder