Skip to content

Instantly share code, notes, and snippets.

View robwormald's full-sized avatar

Rob Wormald robwormald

View GitHub Profile
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();
}

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 { 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'
import * as ng from '@angular/platform'
function todoAppState(state = {todos: [1,2,3]}, action = {type:''}){
switch (action.type) {
case 'ADD_TODO':
return {
todos: state.todos.concat((action as any).payload),
...state
}
default:
//copied from https://github.com/jayphelps/core-decorators
const { defineProperty, getOwnPropertyDescriptor,
getOwnPropertyNames, getOwnPropertySymbols } = Object;
export function isDescriptor(desc) {
if (!desc || !desc.hasOwnProperty) {
return false;
}
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.lit = {})));
}(this, (function (exports) { 'use strict';
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
interface Action {
type: string;
}
enum UserActions {
ADD_USER = 'ADD_USER',
DELETE_USER = 'DELETE_USER'
}
describe(‘My Effects’, () => {
let effects: MyEffects;
let actions: Observable<any>;
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
MyEffects,
provideMockActions(() => actions),
// other providers
@NgModule({
imports: [
StoreModule.forRoot(appReducers),
EffectsModule.forRoot([SourceA, SourceB]),
RouterModule.forRoot([
{ path: ‘lazy’, loadModule: ‘./lazy.module#LazyModule’ }
])
]
})
export class AppModule { }
import {InjectionToken} from '@angular/core'
import {Http} from '@angular/http'
import {Observable} from 'rxjs/Rx'
//simple fn
export function AddDrama(value:string){
return `${value}!!!`
}
export const AddDramaProvider = {