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 = new Web3(context.library.provider); | |
| const thingToSave = { | |
| message: 'Hello world', | |
| owner: address, | |
| }; | |
| const hashedData = web3.eth.accounts.hashMessage( | |
| JSON.stringify(thingToSave) | |
| ); |
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
| name: Default Service - PRO | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest |
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
| // This is the start of the flow, the CLIENT app redirects to this page | |
| app.get('/api/auth/webex', (req, res) => { | |
| // The webex_client_id is an environment variable extracted from the Create integration https://developer.webex.com/docs/integrations | |
| // The scopes and redirect uri are also defined when creating the integration | |
| // Remind to put there your domain url ex: myapp.com or localhost for development | |
| // You will need to change also all the scopes query parameters of this url (you will get them from the "create integration process") | |
| const authUrl = `https://webexapis.com/v1/authorize?client_id=${process.env.WEBEX_CLIENT_ID}&response_type=code&redirect_uri=${encodeURIComponent(process.env.BASE_URL)}%2Fapi%2Fauth%2Fwebex%2Fcallback&scope=meeting%3Arecordings_read%20spark%3Aall%20spark%3Akms%20meeting%3Aschedules_read%20meeting%3Apreferences_write%20meeting%3Arecordings_write%20meeting%3Apreferences_read%20meeting%3Aschedules_write&state=set_state_here` | |
| // We do a redirect to the webex oauth U |
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 canvas = document.getElementById('canvas'); | |
| const context = canvas.getContext('2d'); | |
| let before = Date.now() | |
| let dt = 0 | |
| const totalFigures = 50 | |
| const figures = [] |
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 update(dt) { | |
| const speed = 100 // We can have a different speed per square if we want | |
| figures.forEach(figure => { | |
| figure.x = figure.x + (dt * speed ) > canvas.width ? 0 : figure.x + (dt * speed) | |
| }) | |
| } |
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 loop() { | |
| const now = Date.now() | |
| dt = (now - before) / 1000 | |
| // update(dt) | |
| render() | |
| before = now | |
| window.requestAnimationFrame(loop) |
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 canvas = document.getElementById('canvas'); | |
| const context = canvas.getContext('2d'); | |
| const totalFigures = 50 | |
| const figures = [] | |
| function drawSquare(x, y, size, angleOfRotation) { | |
| // Store the painting state in a stack | |
| context.save() |
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 canvas = document.getElementById('canvas'); | |
| const context = canvas.getContext('2d'); | |
| function drawSquare(x, y, size, angleOfRotation) { | |
| // Translate in the context the origin of coordinates | |
| context.translate(x, y); | |
| // Rotate the context | |
| const radians = Utils.degreeToRadian(angleOfRotation) | |
| context.rotate(radians); |
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 Network from '../network' | |
| // Training data for a xor gate | |
| const trainingData = [{ | |
| input : [0,0], | |
| output: [0] | |
| }, { | |
| input : [0,1], | |
| output: [1] | |
| }, { |
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 sigmoid from './sigmoid' | |
| import Connection from './connection' | |
| import Layer from './layer' | |
| class Network { | |
| constructor(numberOfLayers) { | |
| // Create a network with a number of layers. For layers different than the input layer we add a random Bias to each neuron | |
| this.layers = numberOfLayers.map((length, index) => { | |
| const layer = new Layer(length) | |
| if (index !== 0 ) { |