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
// Retry route Transition, but replace the URL state; just like router.replaceWith('route.name'); | |
abortedTransition.retry().method('replace'); |
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 parseLocation = (function () { | |
var a = document.createElement('a'); | |
function parseLocation(url) { | |
a.href = url; | |
var protocol = (!a.protocol || a.protocol === ':') ? location.protocol : a.protocol; | |
// IE8 inconsistently returns leading slash | |
var pathname = (a.pathname.match(/^\//)) ? a.pathname : '/' + a.pathname; |
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
/** | |
Object.resolve(document, 'body.style') | |
*/ | |
Object.resolve = function resolve(obj, propPath) { | |
return [obj] | |
.concat(propPath.split('.')) | |
.reduce((prevObj, currKey) => prevObj[currKey]); | |
}; |
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 isValidEmail(str) { | |
/** | |
* These comments use the following terms from RFC2822: | |
* local-part, domain, domain-literal and dot-atom. | |
* Does the address contain a local-part followed an @ followed by a domain? | |
* Note the use of lastIndexOf to find the last @ in the address | |
* since a valid email address may have a quoted @ in the local-part. | |
* Does the domain name have at least two parts, i.e. at least one dot, | |
* after the @? If not, is it a domain-literal? | |
* |
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
/** | |
* MIT Licensed (but really, do what you want with it) | |
* | |
* | |
* Usage: | |
* | |
* `IdentifierBuilder.create()` === `a` | |
* `IdentifierBuilder.create()` === `b` | |
* `IdentifierBuilder.create()` === `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
/** | |
* newApply | |
* By Jay Phelps | |
* WTFPL Licensed | |
* | |
* Example: | |
* | |
* function Foo(first, second) { | |
* alert(first + ' ' + second); | |
* } |
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
<!DOCTYPE html> | |
<html> | |
<body> | |
<script type="text/x-handlebars"> | |
<h1>My Great Web App</h1> | |
<div> | |
{{outlet}} | |
</div> | |
</script> | |
<script type="text/x-handlebars" data-template-name="index"> |
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
this.App = Ember.Application.create(); | |
App.IndexController = Ember.ObjectController.extend({ | |
firstName: null, | |
lastName: null, | |
fullName: '$firstName $lastName'.interpolate().readOnly() | |
}); |
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 isValidURL = (function () { | |
var input = document.createElement('input'); | |
input.type = 'url'; | |
function isValidURL(url) { | |
input.value = url; | |
return input.validity.valid; | |
} | |
return isValidURL; |
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 get = Ember.get; | |
var HistoryScrollLocation = Ember.HistoryLocation.extend({ | |
document: document, | |
window: window, | |
_storeScrollPos: function () { | |
var state = history.state, | |
window = get(this, 'window'), | |
doc = get(this, 'document.documentElement'); |
OlderNewer