This file contains 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
//Set the array of arbitrarily nested arrays to startArray | |
//The flattened array is stored in endArray after flatten(startArray) is executed | |
var startArray = [[1,2,[3]],4]; | |
var endArray = new Array(); | |
flatten(startArray); | |
console.log('original: ' + startArray); | |
console.log('flattened: ' + endArray); |
This file contains 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
<html> | |
<body> | |
<div class="readReceiptDemo"> | |
<input id="readMessages" type="submit" value="I've read all the messages" /> | |
<br /> | |
<input id="msgText" type="text" /> | |
<input id="sendMsg" type="submit" /> | |
<div id="messagePanel"></div> | |
</div> | |
</body> |
This file contains 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
pragma solidity ^0.4.18; | |
import 'zeppelin-solidity/contracts/math/SafeMath.sol'; | |
/** | |
* Token | |
* | |
* @title A fixed supply ERC20 token contract. | |
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md | |
*/ |
This file contains 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 EthereumTx = require('ethereumjs-tx'); | |
const privateKeys = require('./truffle-keys').private; | |
const publicKeys = require('./truffle-keys').public; | |
const Token = artifacts.require('./Token.sol'); | |
contract('Token (integration)', function(accounts) { | |
let contract; | |
let owner; | |
let web3Contract; |
This file contains 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 Token = artifacts.require('Token'); | |
module.exports = (deployer) => { | |
deployer.deploy(Token); | |
}; |
This file contains 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 mnemonic = process.env.ethereum_mnemonic; | |
const HDWalletProvider = require("truffle-hdwallet-provider"); | |
require('babel-register'); | |
require('babel-polyfill'); | |
module.exports = { | |
build: "npm run dev", | |
networks: { | |
development: { |
This file contains 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
var pubnub = new PubNub({ | |
publishKey : '__YOUR_PUBNUB_PUBLISH_KEY__', | |
subscribeKey : '__YOUR_PUBNUB_SUBSCRIBE_KEY__' | |
}); | |
var pubnubSMSChannel = '__YOUR_FUNCTION_LISTENING_CHANNEL__'; |
This file contains 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 xhr = require('xhr'); | |
const basicAuth = require('codec/auth'); | |
const username = '__YOUR_CLICKSEND_USER_NAME__'; | |
const authKey = '__YOUR_CLICKSEND_AUTH_KEY__'; | |
const uri = 'https://rest.clicksend.com/v3/sms/send'; | |
const authorization = basicAuth.basic(username, authKey); |
This file contains 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
// A node.js app | |
// Monitors contract events with web3.js and publishes their details over PubNub | |
const Web3 = require('web3'); | |
const PubNub = require('pubnub'); | |
const abi = require('../build/contracts/ShipmentTracking').abi; | |
const providerURI = 'https://mainnet.infura.io/__TOKEN_HERE__'; | |
const ethAddress = process.env.contract_address; |
This file contains 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 EthereumTx = require('ethereumjs-tx'); | |
const privateKeys = require('./truffle-keys').private; | |
const publicKeys = require('./truffle-keys').public; | |
const Token = artifacts.require('./Token.sol'); | |
contract('Token (integration)', function(accounts) { | |
let contract; | |
let owner; | |
let web3Contract; |
OlderNewer