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
((win) => { | |
const XMLHttpRequest = win.XMLHttpRequest; | |
class EventTarget { | |
listeners = {}; | |
addEventListener(type, listener) { | |
const listenersOfType = this.listeners[type]; | |
if (typeof listenersOfType === 'undefined') { |
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
/** | |
* Facade #1: Public/Private Members | |
* | |
* In this example, a "Facade" is placed between the consumer | |
* and the implementation in order to cherry-pick which public | |
* members we wish to expose to the API. | |
*/ | |
class Implementation { | |
constructor() { |
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
/** | |
* Configuration #1: Basic Configuration Class | |
* | |
* A basic example utilising a sealed instance of a configuration | |
* class, with user-provided options merged in upon instantation | |
* of the implementation. | |
*/ | |
class Config { | |
constructor() { |
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
/** | |
* Factory #1: Constructor Instantiation | |
* | |
* This example shows basic abstraction of constructor/class | |
* instantation. Additional error checking, validation of arguments | |
* could be added inside the factory, or just delegated to the constructor. | |
*/ | |
import Implementation from './Implementation'; |
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
{ | |
"env": { | |
"node": true, | |
"browser": true | |
}, | |
"globals": { | |
"Promise": true, | |
"Reflect": true, | |
"Symbol": true, | |
"describe": true, |
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
getProperty = function(obj, stringKey) { | |
var parts = stringKey.split('.'), | |
returnCurrent = null, | |
current = '', | |
i = 0; | |
if (!stringKey) { | |
return obj; | |
} |
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
# URL | |
http://<instance-namespace>.eu-west-1.compute.amazonaws.com:8111/ | |
# Create teamcity instance | |
docker run -d --name teamcity-server-instance -p 8111:8111 -v ~/data/teamcity:/data/teamcity jetbrains/teamcity-server | |
// change `-d` to `-it` for debug mode |
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
// dash or snake to camel | |
String.prototype.toCamel = function() { | |
return this.replace(/([_-][a-z0-9])/g, function($1) { | |
return $1.toUpperCase().replace(/[_-]/, ''); | |
}); | |
}; | |
// camel or pascal to snake |