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 Foo { | |
| constructor(time, answer) { | |
| this._time = time; | |
| this._answer = answer; | |
| } | |
| get time() { | |
| return this._time; | |
| } | |
| is() { | |
| return new Promise(res => setTimeout(() => res(this._answer), this._time)); |
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 FindProxyForURL(url, host) { | |
| if (shExpMatch(host, "*.slack-msgs.com")) { | |
| // Use SOCK proxy, | |
| // or fall back to a DIRECT traffic. | |
| // ssh -D 8000 [user]@[server] | |
| return "SOCKS 83.174.203.210:1080; DIRECT"; | |
| } | |
| return "DIRECT"; |
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 getDomDepthLevel(root = document.documentElement) { | |
| let pathInfo = { | |
| route: [], | |
| level: 0 | |
| }; | |
| for (let i = 0, j = root.children.length; i < j; i++) { | |
| const curNodePathInfo = getDomDepthLevel(root.children[i]); | |
| if (curNodePathInfo.level > pathInfo.level) { | |
| pathInfo = curNodePathInfo; | |
| } |
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 a noisy scenario, which tests sms gateway api, | |
| * when user is trying to get a verification code on his / her | |
| * smartphone | |
| */ | |
| (function() { | |
| 'use strict'; | |
| /* |
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
| All in one file example: | |
| var buisnessModule = (function() { | |
| var SomeConstructor = function SomeConstructor() { | |
| if( !( this instanceof SomeConstructor ) ) { | |
| return new SomeConstructor(arguments); | |
| } | |
| this.params = Array.prototype.slice.call(arguments); | |
| }; |