Skip to content

Instantly share code, notes, and snippets.

View robwormald's full-sized avatar

Rob Wormald robwormald

View GitHub Profile
ngOnInit() {
this.example = this.route.params
.switchMap(params => this.exampleService.getExample(params.id));
}
@robwormald
robwormald / ProductListComponent.js
Last active March 21, 2016 02:18 — forked from tiddle/ProductListComponent.js
Product List Component
class AppComponentController {}
export const AppComponent {
bindings: {
products: '=',
sort: '&'
},
controller: AppComponentController
}
"format register";
System.register("angular2/src/facade/lang", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
"format register";
System.register("rxjs/util/noop", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
function noop() {}
exports.noop = noop;
global.define = __define;
return module.exports;
});
@robwormald
robwormald / test.js
Last active September 3, 2015 22:20
var a = [{q : 2}, {q : 3}];
var qs = a.map(function(obj){ return obj.q });
//how will i use a 'for' loop to return a new array like that will look like this [2, 3] ?
function processVertex(parent, vertices, children) {
var vertex = null, vertexChildren = null;
if (children && angular.isArray(children)) {
_.each(children, function(id) {
// find child in old data model by vertex id
vertex = _.find(vertices, { vertexId: id });
if (vertex) {
import * as di from './annotations';
const Inject = (...dependencies) => {
return (classDef) => {
di.annotate.apply(di, [classDef].concat(dependencies.map((dep) => new di.Inject(dep))));
}
}
const Provide = (targetClassDef) => {
return (classDef) => {
@robwormald
robwormald / t.js
Last active August 29, 2015 14:17
//returns array of users
function getUser(){
return fetch('user.json');
}
function getAccountsForUser(user){
return fetch(`users/${user.id}/accounts`);
}
function getPropertiesForAccount(account){
@robwormald
robwormald / JWT.js
Last active August 29, 2015 14:13 — forked from sonicparke/JWT.js
(function(){
app.factory('JWT', JWT);
function JWT($window, $q){
var store = $window.localStorage;
var key = 'AXC_API_Storage.Token';
var service = {
getToken: getToken,
SomeService.placeSearch(options).then(function(results){
res.json(results);
})