- Things placed in the registry are effectively black boxes with regards to the rest of the system. This makes it harder to detect and recover from their errors, and may make the system as a whole less reliable.
- The registry must be unique, which can make it a bottleneck for concurrent applications.
- The registry can be a serious security vulnerability, because it allows outsiders to inject code into an application.
- The registry hides the class' dependencies, causing run-time errors instead of compile-time errors when dependencies are missing.
- The registry makes the code more difficult to maintain (opposed to using Dependency injection), because it becomes unclear when you would be introducing a breaking change
- The registry makes code harder to test, since all tests need to interact with the same global service locator class to set the fake dependencies of a class under test.
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<appSettings> | |
<add key="kpm-package-path" value="..\approot\packages" /> | |
<add key="bootstrapper-version" value="1.0.0-beta1" /> | |
<add key="kre-package-path" value="..\approot\packages" /> | |
<add key="kre-version" value="1.0.0-beta1" /> | |
<add key="kre-clr" value="CoreCLR" /> | |
<add key="kre-app-base" value="..\approot\packages\App\1.0.0\root" /> | |
</appSettings> |
This file contains 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
export class ComponentA { | |
render() { | |
return <form onSubmit={this.handleSubmit}>...</form>; | |
}, | |
handleSubmit(e) { | |
// TODO: handle submit | |
} | |
} |
This file contains 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
export class ComponentA { | |
render() { | |
return <form onSubmit={this.handleSubmit}>...</form>; | |
}, | |
handleSubmit(e) { | |
// TODO: handle submit | |
} | |
} |
This file contains 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 { Promise } = require('es6-promise'); | |
export class HttpClient { | |
get(url) { | |
// Return a new promise | |
return new Promise((resolve, reject) => { | |
// Do the usual XHR stuff | |
var request = new XMLHttpRequest(); | |
request.open('GET', url, true); |
This file contains 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
// Media queries breakpoints | |
// ------------------------------------------------------------------------------ | |
// Small screen / tablet | |
@screen-sm-min: 768px; | |
// Medium screen / desktop | |
@screen-md-min: 992px; | |
// Large screen / wide desktop |
This file contains 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
/* | |
* React.js Starter Kit | |
* Copyright (c) 2014 Konstantin Tarkus (@koistya), KriaSoft LLC. | |
*/ | |
'use strict'; | |
var Dispatcher = require('../core/Dispatcher'); | |
var ActionTypes = require('../constants/ActionTypes'); | |
var SourceTypes = require('../constants/SourceTypes') |
This file contains 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 (typeof String.prototype.startsWith != 'function') { | |
String.prototype.startsWith = function(str) { | |
return this.lastIndexOf(str, 0) === 0; | |
}; | |
} |
Write a function which transforms a URL path like /a/b/c
into an array ['/', '/a', '/a/b', '/a/b/c']
(function split(path, array) {
return path === '/' ? ['/'].concat(array) :
split('/' + path.substr(1, path.lastIndexOf('/') - 1), [path].concat(array));
})('/a/b/c', []);
This file contains 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
.DS_Store | |
.AppleDouble | |
.LSOverride | |
# Icon must end with two \r | |
Icon | |
# Thumbnails | |
._* |