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 WebSocketClient = require('websocket').client; | |
const client = new WebSocketClient({tlsOptions: {rejectUnauthorized: false}}); | |
let currentBlockFilter = '' | |
let lastMessageReceived = new Date().getTime() | |
let lastPing = new Date().getTime() | |
let lastBlockTime = new Date().getTime() | |
let totalBlockTime = 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
// Method 1: | |
class Parent extends Component { | |
state = { foo: '', bar: '', buzz: '' } | |
render() { | |
return ( | |
<Child | |
setParentState={this.setState} | |
> | |
) |
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 prompt = require('prompt'); | |
class TicTacToe { | |
constructor() { | |
this.winner = null; | |
this.board = [ | |
[' ', ' ', ' '], | |
[' ', ' ', ' '], | |
[' ', ' ', ' '], |
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 vowelDoubler = array => { | |
const vowels = ['a', 'e', 'i', 'o', 'u']; | |
let resultLength = array.length; | |
for (let i = 0; i < array.length; i += 1) { | |
if (vowels.includes(array[i])) { | |
resultLength += 1; | |
} | |
} | |
let offset = resultLength - array.length; | |
for (let i = resultLength - 1; i >= 0; i -= 1) { |