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 getLastEan13Digit(ean) { | |
| if (!ean || ean.length !== 12) throw new Error('Invalid EAN 13, should have 12 digits') | |
| const multiply = [1, 3] | |
| let total = 0 | |
| ean.split('').forEach((letter, index) => { | |
| total += parseInt(letter, 10) * multiply[index % 2] | |
| }) |
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
| Array.prototype.forEach = function (callback) { | |
| // this represents our array | |
| for (let index = 0; index < this.length; i++) { | |
| // We call the callback for each entry | |
| callback(this[index], index, this) | |
| } | |
| } |
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 waitFor = (ms) => new Promise((resolve) => setTimeout(resolve, (ms || 0))) | |
| [1, 2, 3].forEach(async (num) => { | |
| await waitFor(50) | |
| console.log(num) | |
| }) | |
| console.log('Done') |
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
| <template> | |
| <div> | |
| <h1>Welcome!</h1> | |
| <nuxt-link to="/about">About page</nuxt-link> | |
| <img :src="flagUrl"/> | |
| <button @click="nextFlag">Next flag</button> | |
| </div> | |
| </template> | |
| <script> |
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
| <html lang="en"><head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> | |
| <link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAADjklEQVR4AWI08P/HQEvAQrxSQKvlECfLFYXx75xCY2qmh89GbNvOMjb3v9jOOlxnFWxj206ebQ3b7q6q+z1rNagu8/zvPSZACAABpeUAA0miMgU7SA7JjCraFGwZwECOwvL75dWjsKgWBKtx0jvWo+vkBAFbACCkByMP6nMn48+AVgXB2fzSCwsv22/lMGlUhmJ0AE7BH8dyUUDbUEgN6RzJRSeaPxhdRYR0Inel+7Hd5lBiFpkMAxACc0394//9C4voFHDiAAGLpuOXebdfdHfctgwJKaZRLRKy6ItrSis6RBnVBgGtbHyKTEmJHQoEXoBCE5BCrDeA2ogMUIGDAKEBDEhUqwgMqBYDjW4DQzmuffVdqff42/ZQYYqVcMXGZsMPyCsH3lyJSetxvEaxAQXdjR1HjfwCdIS7lo2DZke26Qe+MXO12OWkGT0O6oE7vMGkMnkYw4aN1KQgMKExhXqswfiov4+a7MQ11XPnbr/5qpKlgACAAQj94Lu271bN9DUecQasIZlNzG72llRAAKJiAi+/BSHrSFjRvQhg3DEKEqJh08tsmLTx597+f6enr4cc2Zpk57pihfX24dW7RHcOLLUbJYhJSl0ErQCI9BVXH/XrO97QasuvQQSiECa0BrQCIIJp6X9T/r8QG6L71WYSqCoIIGo2BZDUBnS/D9EA9Nun1iYvbM0MFExIDQRoKFatc1Z6zrm5uWeObJotq0BGV9FuQBWq5a4Fw3PPz848rZHstZSuA5FWAFSMP2nOppOOGpl6qh9PCSg0IFyHKjSQy |
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 http = require('http'), | |
| request = require('request'), | |
| port = 8000; | |
| http.createServer(function (req, res) { | |
| console.log('Proxying url ['+req.url+']'); | |
| if (req.url.indexOf('http://candycrush.king.com/api') !== -1 && req.method === 'GET') { | |
| request(req.url, function (err, response, body) { | |
| for (var header in response.headers) { | |
| res.setHeader(header, response.headers[header]); |
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
| text: Je suis une petite hirondelle qui adore sautiller dans l'herbe chanté bébé à l'@email ! | |
| analyzer: | |
| standard: | |
| type: standard | |
| simple: | |
| type: simple | |
| stop: | |
| type: stop | |
| snowball: |
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 http = require('http'); | |
| var fs = require('fs'); | |
| var io = require('socket.io'); | |
| // La page HTML | |
| var html = '<meta charset="UTF-8">' | |
| + '<script type="text/javascript" src="/socket.io/socket.io.js"></script>' | |
| + '<script type="text/javascript">' | |
| + 'var socket = io.connect();' | |
| + 'socket.on("serverConsole", function (message) {' |
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 countDown = function (endDate, el) { | |
| el = el || $('body'); | |
| var leadingZero = function (nb) { | |
| return (nb < 10) ? "0" + nb : + nb; | |
| }; | |
| var updateTimer = function (seconds) { | |
| var days = Math.floor(seconds / 86400); | |
| seconds -= days * 86400; | |
| var hours = Math.floor(seconds / 3600); | |
| seconds -= hours * (3600); |
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
| /* | |
| ** Client side - /public/src/app.js | |
| */ | |
| var myApp = { | |
| // Collections | |
| Collections: { | |
| list: Backbone.Collection.extend() | |
| }, | |
| // Views |
NewerOlder