Skip to content

Instantly share code, notes, and snippets.

View robwormald's full-sized avatar

Rob Wormald robwormald

View GitHub Profile
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) => {
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) {
@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] ?
"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;
});
class ParentViewCtrl
@$inject: ['$scope', '$location']
constructor: (@scope, @location) ->
@scope.fun_times = @fun_times
@scope.some_ojects = @some_objects
fun_times: =>
console.log "something something"
some_objects: [
innitApp.provider('API',function(){
//temp storage for new collection
var _collections = []
//holds model references
var _models = {}
return {
//this fires when the provider is injected
$get : ['$resource',function($resource){
"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 __() {
@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
}
ngOnInit() {
this.example = this.route.params
.switchMap(params => this.exampleService.getExample(params.id));
}
@robwormald
robwormald / find.js
Last active February 13, 2017 10:01 — forked from Samstiles/find.js
/**
* Find Records
*
* An API call to find and return model instances from the data adapter
* using the specified criteria. If an id was specified, just the instance
* with that unique id will be returned.
*
* @param {Integer|String} id - the unique id of the particular instance you'd like to look up
* @param {Object} where - the find criteria (passed directly to the ORM)
* @param {Integer} limit - the maximum number of records to send back (useful for pagination)