Skip to content

Instantly share code, notes, and snippets.

View msfrisbie's full-sized avatar

Matt Frisbie msfrisbie

View GitHub Profile
@msfrisbie
msfrisbie / gist:23ed5df17ce8eaf506a7
Last active August 29, 2015 14:09
Dependency Injection
// AtScript
import {Component} from 'angular';
import {Server} from './server';
@Component({selector: 'foo'})
export class MyComponent {
constructor(server:Server) {
this.server = server;
}
}
@msfrisbie
msfrisbie / gist:429a0643e44f3bf166bf
Last active August 29, 2015 14:09
Templating and Data Binding
// your mileage may vary!!!!
// Component Directive
@ComponentDirective({
// CSS selector which is used to match this directive to
selector:'tab-container',
// template dependencies
@msfrisbie
msfrisbie / gist:8076ccb20956c5f81fb0
Last active August 29, 2015 14:09
Template Syntax
General proposed syntax (via Rob Eisenberg):
property="{{expression}}" -- one way binding from a model to the property on the element, identified by {{}}
on-event="{{expression}}" -- adds an event handler to the event which executes the expression, identified by the on- prefix
${expression} -- string interpolation within HTML content and attributes (based on ES6 syntax)
This is necessitated by the following tenets:
https://github.com/angular/router
https://github.com/angular/router/tree/master/examples
Will be backported to 1.3 soon!
router.configure(config => {
config.map([
{ pattern: ['', 'intro'], componentUrl: 'intro' },
@msfrisbie
msfrisbie / gist:32d4d093bb333aaa1e66
Last active August 29, 2015 14:09
Links and References
http://www.html5rocks.com/en/tutorials/es7/observe/
http://ng-learn.org/2014/03/AngularJS-2-Status-Preview/
http://eisenbergeffect.bluespire.com/all-about-angular-2-0/
http://www.w3.org/wiki/WebComponents/
https://docs.google.com/document/d/11YUzC-1d0V1-Q3V0fQ7KSit97HnZoKVygDxpWzEYW0U/edit
https://speakerdeck.com/rauschma/ecmascript-6-whats-next-for-javascript-august-2014
http://pascalprecht.github.io/2014/10/25/integrating-web-components-with-angularjs/
https://docs.google.com/document/d/1kpuR512G1b0D8egl9245OHaG0cFh0ST0ekhD_g8sxtI/edit#heading=h.xgjl2srtytjt
https://docs.google.com/presentation/d/1Gv-dvU-yy6WY7SiNJ9QRo9XayPS6N2jtgWezdRpoI04/present?slide=id.g108668b30_040
http://code.tutsplus.com/tutorials/using-polymer-to-create-web-components--cms-20475
@msfrisbie
msfrisbie / gist:32472168fac36c85eba3
Last active August 29, 2015 14:09
Custom Elements
// JS definition
var SignupElementProto = Object.create(HTMLElement.prototype);
var SignupElement = document.registerElement('signup-page', {
prototype: SignupElementProto
// element property definition(s)
});
<signup-page></signup-page>
OR
<div>
#{{ player.number }} {{ player.name }}
</div>
@msfrisbie
msfrisbie / gist:b0c6eceb11adfbcbf482
Last active August 29, 2015 14:11
Testing Chapter Changes, Updates, and Errata
No reported errors yet!
Please email me at msfrisbie at gmail.com if you think something belongs here.
@msfrisbie
msfrisbie / gist:f39018bd6e44af1fd631
Created January 24, 2015 03:09
Scope watcher counter
var getWatchers = function (element) {
// convert to a jqLite/jQuery element
// angular.element is idempotent
var el = angular.element(
// defaults to the body element
element || document.getElementsByTagName('body')
)
// extract the DOM element data
, elData = el.data()
// initalize returned watchers array
Permission is hereby granted to any person or organization obtaining a copy of Metrc Toolkit software (the “Software”) to run the Software on their computer[s] and to publish without restriction any output produced by the Software, including screenshots. This license prohibits you from copying, publishing, and/or distributing source code in either original or modified form. This license prohibits you from making the Software available for public use, commercial or non-commercial, in either original or modified form. This license prohibits you from claiming ownership or authorship of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR SOFTWARE AUTHORS BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALI