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
function loadScript(path, fn) { | |
var el = document.createElement('script') | |
, loaded = 0 | |
, onreadystatechange = 'onreadystatechange' | |
, readyState = 'readyState'; | |
el.onload = el.onerror = el[onreadystatechange] = function () { | |
if (loaded || (el[readyState] && !(/^c|loade/.test(el[readyState])))) return; | |
el.onload = el.onerror = el[onreadystatechange] = null; | |
loaded = 1; |
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
public class ConcreteFormValidator extends FormValidator<FormDTO> { | |
private NumericStringValidator numericStringValidator; | |
public ConcreteFormValidator(NumericStringValidator numericStringValidator) { | |
this.numericStringValidator = numericStringValidator; | |
} | |
@Override | |
public List<Message> validate(FormDTO form) { | |
return collectMessages(this.numericStringValidator.validate(form.getA(), "first"), |
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
#!/bin/sh | |
# Compile and show [GFM](https://help.github.com/articles/github-flavored-markdown) docs in your browser. | |
# Before this works you need to `gem install bcat` | |
# | |
# Usage: gfm.sh FILE.md | |
# | |
curl --silent --data-binary @- https://api.github.com/markdown/raw -H "Content-Type: text/plain" | bcat |
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
function inherit (child, parent) { | |
function proxy () {}; | |
proxy.prototype = parent.prototype; | |
child.prototype = new proxy(); | |
}; | |
function Parent () {} | |
function Child () {} | |
inherit(Child, Parent); |