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
| import { Component } from "React"; | |
| export var Enhance = ComposedComponent => class extends Component { | |
| constructor() { | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } | |
| render() { |
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 retry(isDone, next) { | |
| var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false; | |
| var id = window.setInterval( | |
| function() { | |
| if (isDone()) { | |
| window.clearInterval(id); | |
| next(is_timeout); | |
| } | |
| if (current_trial++ > max_retry) { | |
| window.clearInterval(id); |
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 shuffle(array){ | |
| for(var i = array.length-1; i > 0; i--) { | |
| var rnd = Math.floor(Math.random() * (i+1)); | |
| var tmp = array[i]; | |
| array[i] = array[rnd]; | |
| array[rnd] = tmp; | |
| } | |
| } | |
| function isInOrder(array) { | |
| for(var i = 0; i < array.length-1; i++) |
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
| var crypto = require('crypto'); | |
| var AESCrypt = {}; | |
| AESCrypt.decrypt = function(cryptkey, iv, encryptdata) { | |
| encryptdata = new Buffer(encryptdata, 'base64').toString('binary'); | |
| var decipher = crypto.createDecipheriv('aes-256-cbc', cryptkey, iv), | |
| decoded = decipher.update(encryptdata); |