Skip to content

Instantly share code, notes, and snippets.

View PatrickJS's full-sized avatar

PatrickJS PatrickJS

View GitHub Profile
@jimthedev
jimthedev / falcor-express-server-with-logging.js
Created August 20, 2015 22:05
Falcor with express featuring split route files and route access logging
// ...
// ... SNIP: You should include and wire up express as needed before this
// ...
// Falcor deps
var falcor = require('falcor');
var falcorExpress = require('falcor-express');
var bodyParser = require('body-parser');
// ROUTES
@btholt
btholt / falcorApp.jsx
Created August 11, 2015 20:31
Falcor + React
const React = require('react');
const _ = require('lodash');
var model = new falcor.Model({
cache: {
movies: [
{
title: "Daredevil",
plot: "Marvel lol",
year: "2015-",
// Copy an Object with property descriptors
var copy = Object.create(Object.getPrototypeOf(node));
Object.getOwnPropertyNames(node).forEach(propName => {
Object.defineProperty(copy, propName, Object.getOwnPropertyDescriptor(node, propName));
});
@alexeagle
alexeagle / angular2.d.ts
Last active August 29, 2015 14:22
angular2.d.ts
// Type definitions for Angular v2.0.0-alpha.26
// Project: http://angular.io/
// Definitions by: angular team <https://github.com/angular/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// ***********************************************************
// This file is generated by the Angular build process.
// Please do not create manual edits or send pull requests
// modifying this file.
// ***********************************************************
@capaj
capaj / app-config.js
Created May 27, 2015 09:07
useful config for your angular apps
app.config(function($compileProvider) {
if (!location.host.match(/localhost/)) {
$compileProvider.debugInfoEnabled(false);
}
})
// <script src="angular.min.js"></script>
(function(name, factory) {
// our basic IO module system that stores every module on modules with the "file" namespace
// please use something like browserify rather than rolling your own like this
window.modules = window.modules || {};
window.require = window.require || function require(name) { return window.modules[name] || window[name]; };
var exports = {}; factory(exports, window.require);
window.modules[name] = exports;
}('TodoService', function(exports, require) {
@davideast
davideast / index.ts
Created April 15, 2015 17:25
Simple Angular 2 Forms with Firebase
import {bootstrap, Component, Decorator, View, If, For, EventEmitter} from 'angular2/angular2';
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
@Component({
selector: 'app',
injectables: [FormBuilder]
})
@View({
template: `
<div class="container" [control-group]="myForm">
/*
The MIT License (MIT)
Copyright (c) 2014
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@shuhei
shuhei / 1_before.js
Last active August 29, 2015 14:17
Angular 2 annotation with babel (babel --experimental with experimental branch)
import {Component as _Component, Template as _Template} from 'angular2/src/core/annotations/annotations';
function makeDecorator(annotationClass) {
return (options) => {
return (klass) => {
klass.annotations = klass.annotations || [];
klass.annotations.push(new annotationClass(options));
return klass;
};
};
@cameron
cameron / README.md
Last active August 29, 2015 14:16
angular.module().view()

ng.module.view

module.view() is a deliberately half-baked attempt at implementing a web components pattern in angular.

It began as a convenience wrapper on module.directive() to avoid specifying the templateUrl in a context where the templateUrl is derivable from the name of the view.

It also allows views to be included via expression (see example below), which is useful for routing, modals, and other dynamic view inclusion.

Defining a widget with a controller