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 Stream = require('stream'); | |
| const readableStream = new Stream.Readable(); | |
| readableStream.push('Hola'); | |
| readableStream.push(' '); | |
| readableStream.push('Mundo'); | |
| readableStream.push(null); | |
| async function getContentReadStream(readable) { | |
| for await (const chunk of readable) { |
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 isPalindrome(str) { | |
| const replaceStr = str.replace(/[^A-Za-z0-9]/g, '').toLowerCase(); | |
| const reverseString = replaceStr.split('').reverse().join(''); | |
| return replaceStr === reverseString; | |
| } | |
| console.log(isPalindrome("EYES")); // true | |
| console.log(isPalindrome("not is palindrome")); // false |
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 abcValues = [ | |
| "A", | |
| "B", | |
| "C", | |
| "D", | |
| "E", | |
| "F", | |
| "G", | |
| "H", | |
| "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
| from threading import Thread | |
| def counter(): | |
| for i in range(1, 11): | |
| print(i) | |
| t = Thread(target=counter) | |
| t.start() |
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
| db.createCollection('valorizacion'); | |
| db.getCollection('valorizacion').insertOne({ | |
| motorPrecio: "", | |
| fechaCreacion: "", | |
| datosVehiculo: { | |
| descripcionMarca: "", | |
| descripcionModelo: "", | |
| descripcionVersion: "", | |
| descripcionColor: "", | |
| ano: "", |
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 romanSymbols = { | |
| '1': 'I', | |
| '2': 'II', | |
| '3': 'III', | |
| '4': 'IV', | |
| '5': 'V', | |
| '6': 'VI', | |
| '7': 'VII', | |
| '8': 'VIII', | |
| '9': 'IX', |
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 { exec } = require('child_process'); | |
| url = "https://www.youtube.com/"; | |
| cmdCommand = `start chrome /new-tab ${url}`; | |
| exec(cmdCommand); |
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
| // ^\([0-9]{3}\)[0-9]{3}-[0-9]{4}$ | |
| function isEEUUPhoneNumber(number) { | |
| const reg = /[-+]?(?:\d{1,2}\s)?\(*(?:\d{3})(?:-|\)|\)\s|\s)*\d{3}(?:-|\s)*\d{4}/; | |
| return reg.test(number); | |
| } | |
| console.log(isEEUUPhoneNumber("1(555)555-5555")); // true | |
| console.log(isEEUUPhoneNumber("(555)555-5555")); // false | |
| console.log(isEEUUPhoneNumber("2(757)6227382")); //false |
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
| class Node { | |
| constructor(value, next) { | |
| this.value = value; | |
| this.next = next; | |
| } | |
| } | |
| class LinkedList { | |
| constructor() { | |
| this.head = null; |
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 rotateLeft(d, arr) { | |
| while (d > 0) { | |
| const leftElement = arr.shift(); | |
| arr.push(leftElement); | |
| d--; | |
| } | |
| return arr; | |
| } | |
| console.log(rotateLeft(2, [1, 2, 3, 4, 5])); // [3, 4, 5, 1, 2] |