Skip to content

Instantly share code, notes, and snippets.

View robwormald's full-sized avatar

Rob Wormald robwormald

View GitHub Profile
import {rollup} from 'rollup'
import * as path from 'path'
class RollupNG2 {
constructor(options){
this.options = options;
}
resolveId(id, from){
if(id.startsWith('angular2/')){
return `${__dirname}/node_modules/angular2/es6/prod/${id.split('angular2/').pop()}.js`;
function toResponseActions(successSelector, errorSelector){
return (requests$) => requests$.pipe(
catchError(err, => errorSelector(err)),
map(res => successSelector(res))
)
}
const buttonClicks = fromEvent('button', 'click');
const requests = buttonClicks.pipe(switchMap(() => http.get('foo.json')));
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
typeof define === 'function' && define.amd ? define(factory) :
//existing proposal
@Component({
selector: 'foo'
})
export class MyComponent {
render(){}
}
//new proposal
@Component({
selector: 'app-device-detail',
templateUrl: './device-detail.component.html',
styleUrls: ['./device-detail.component.css']
})
export class DeviceDetailComponent {
constructor(private route: ActivatedRoute, private deviceService: DeviceService) { }
device$ = this.route.params.pipe(this.deviceService.toDevice);
deviceState$ = this.device$.pipe(this.deviceService.toDeviceState);
export class DeviceDetailComponent {
constructor(private route: ActivatedRoute, private deviceService: DeviceService) { }
device$ = this.route.params.pipe(this.deviceService.toDevice);
deviceState$ = this.device$.pipe(this.deviceService.toDeviceState);
deviceMeasurements$ = this.device$.pipe(this.deviceService.toMeasurements);
trackMeasurement = (id, rec) => (`${rec.timestamp.seconds}${rec.timestamp.nanoseconds}`);
}

Hello -

I am currently staying at the David Intercontinental in Tel Aviv, Israel - I'm here on business for 10 days - I'm a web software engineer at Google in Mountain View, California.

While reading a close friend's blog using the hotel wifi (note I am using the paid service), a popup appeared midway down the page asking me to use my room number to "get the latest digital services" from the hotel:

ad

As my friend's blog is hosted in the US, and he's never been to to the David hotel or Israel, for that matter, I thought it was somewhat odd that his website would be asking me anything like this. So, I jumped on my laptop, and visited the page from there with Chrome's developer tools running.

import {ɵrenderTemplate as renderTemplate} from '@angular/core'
export function withNgTemplate(Base = HTMLElement){
return class NgTemplateElement extends HTMLElement {
_renderRoot: HTMLElement | ShadowRoot;
_host:any;
_renderer(root:HTMLElement | ShadowRoot, renderFn:any){
renderFn();
}
import { BrowserModule } from '@angular/platform-browser';
import { createCustomElement } from '@angular/elements';
import { NgModule, Injector, NgModuleFactory, NgModuleRef } from '@angular/core';
import { SomeService } from './service'
import { AppComponent } from './app.component';
import { DemoElementModule, DemoElement } from './demo-element'
import { DemoElementModuleNgFactory } from './demo-element.ngfactory'
//copied from https://github.com/jayphelps/core-decorators
const { defineProperty, getOwnPropertyDescriptor,
getOwnPropertyNames, getOwnPropertySymbols } = Object;
export function isDescriptor(desc) {
if (!desc || !desc.hasOwnProperty) {
return false;
}