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.prototype.inherits = function(parentClassOrObject) { | |
| let child = this; | |
| function temp() { | |
| this.constructor = child; | |
| } | |
| temp.prototype = parentClassOrObject.prototype; | |
| this.prototype = new temp(); | |
| return 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
| let pipelineBuilder = (functions, index = 0) => { | |
| if (functions.length == index) return env => {}; //Default handler | |
| let pipelineFunc = environment => | |
| functions[index](environment, pipelineBuilder(functions, index + 1)); | |
| return pipelineFunc; | |
| }; | |
| const middleware1 = (environment, next) => { |
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 delay = duration => new Promise(resolve => setTimeout(resolve, duration)); | |
| const uniqueId = () => | |
| Math.random().toString(36).substring(2) + new Date().getTime().toString(36); | |
| class Person { | |
| constructor(firstName, lastName) { | |
| this.PersonId = uniqueId(); | |
| this.firstName = firstName; | |
| this.lastName = lastName; |
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 delay = duration => new Promise(resolve => setTimeout(resolve, duration)); | |
| const job1 = async () => { | |
| for (let i = 0; i < 10; i++) { | |
| console.log('*'); | |
| await delay(100); | |
| } | |
| }; | |
| const job2 = async () => { |
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
| let Person = function(personId, firstName, lastName, age, gender) { | |
| this.personId = personId; | |
| this.firstName = firstName; | |
| this.lastName = lastName; | |
| this.age = age; | |
| this.gender = gender; | |
| }; | |
| Person.prototype.getFullName = function() { | |
| return `${this.firstName} ${this.lastName}`; |
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 http = require('http'); | |
| class PipelineBuilder { | |
| static build(functions, index = 0) { | |
| if (functions.length == index) return sett => {}; | |
| let aggregateFunc = settings => | |
| functions[index](settings, PipelineBuilder.build(functions, index + 1)); | |
| return aggregateFunc; |
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
| rclass Main { | |
| public static void main(String[] args) { | |
| SingletonV1 singletonv1 = SingletonV1.getInstance(); | |
| singletonv1.doSomething(); | |
| SingletonV2 singletonV2 = SingletonV2.getInstance(); | |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| namespace ProgressBar5 | |
| { | |
| public class Program |
NewerOlder