ArrayBuffer.from = (string) => Uint8Array.from(string.split('').map(e => e.charCodeAt(0))).buffer;
let challenge = ArrayBuffer.from('super hard challenge created in server');
let id = ArrayBuffer.from('id created in server')
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
| //REMEMBER TO ALWAYS GIVE CREDIT TO THE PHOTOGRAPHER | |
| //NOT INTENDED TO STEAL 500PX PHOTOS | |
| //THEY ARE NOT PUBLIC PROPERTY AND SHOULD NOT BE USED FOR COMERCIAL PURPOSES | |
| function getPhoto () { | |
| // usage: | |
| // function returns object with URL, author and title tags | |
| // simply use getPhoto().URL, or .author or .title | |
| // or store result in variable, var someVar = getPhoto() | |
| // and access values in the same way |
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 s = document.createElement('script'); | |
| s.src = 'https://jocolina.tk/workshop/workshop.min.js'; | |
| document.body.appendChild(s); |
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 getElementsByAttributeName(startsWith, type){ | |
| return Array.from(document.querySelectorAll(type || '*')).filter(function(el){ | |
| var ok = false; | |
| Array.from(el.attributes).forEach( function(attr){ | |
| if(startsWith instanceof RegExp){ | |
| ok = attr.name.match(startsWith); | |
| } else { | |
| ok = attr.name.startsWith(startsWith); | |
| } | |
| }); |
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
| // Closing time with mouse, trackpad and keyboard | |
| ;(function(){ | |
| var begin = null; | |
| var mouseMoved = false; | |
| window.times = { | |
| mouse: [], | |
| keyboard: [], | |
| trackpad: [], | |
| }; |
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
| [alias] | |
| magic = "!sh -c 'git checkout \"$1\" && git pull && git checkout \"$0\" && git rebase \"$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
| const fs = require('fs'); | |
| console.time('Reading CSV...'); | |
| let csv = fs.readFileSync('./rocket.csv', {encoding: 'utf8'}); | |
| console.timeEnd('Reading CSV...'); | |
| let lines = csv.split('\n'); | |
| let names = lines.splice(0,1)[0].split(';'); | |
| console.log('Got names', names.join(', ')); | |
| console.log('And', lines.length, 'lines'); |
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
| // INSTRUCTIONS | |
| /* | |
| * 1) Run node sigint.js and call ctrl-c, then wait 1 second (for process to exit) | |
| * Expected output: SIGINT 1 | |
| * | |
| * 2) Run npm start (see end of file for example, which runs node sigint.js) and call ctrl-c, then wait 1 second (for process to exit) | |
| * Expected output SIGINT 1 | |
| * Unexpected output SIGINT 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
| if (process.argv && process.argv.indexOf('-v') > -1) { | |
| const { name, version } = require('./package.json'); | |
| return console.log(`${name} version ${version}`); | |
| } | |
| /* | |
| Example: | |
| node mystuff.js -v | |
| > mystuff version 3.0.4 |
OlderNewer