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
/** | |
* Super namespace that all our libs and apps will live on. We also extend all | |
* of the native Ember classes as well and exclusely use them that way so we can | |
* alter the behavior in one place without needing to reopen the original class. | |
* | |
* We call the super namespace PS for Pivotshare, call it what you'd like. | |
*/ | |
window.PS = Ember.Namespace.create(); | |
// Create our custom resolver so we can have Ember look up classes on multiple |
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 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'); |
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 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]); | |
}; |
OlderNewer