This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Directive, HostListener, Input } from '@angular/core'; | |
import { AnalyticsService } from './analytics.service'; | |
/** | |
* @description | |
* This directive adds a click listener on an element | |
* and send events to google analytics. | |
* | |
* Usage: | |
* Add myGA as an attribute to the clickable element. | |
* Provide a string with an category, label and action |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TestBed, ComponentFixture } from '@angular/core/testing'; | |
import { Component } from '@angular/core'; | |
import { AnalyticsService } from '../services/analytics.service'; | |
import { | |
AnalyticsEventDirective | |
} from './analytics-events.directive'; | |
// create a component using the directive we want to test | |
// eventString is a variable we can change to test behaviour |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { Http } from '@angular/http'; | |
import { Observable } from 'rxjs'; | |
export interface Todo { | |
name: string; | |
completed: boolean; | |
} | |
@Component({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ComponentFixture, TestBed } from '@angular/core/testing'; | |
import { TodoListComponent } from './todolist'; | |
import { Http } from '@angular/http'; | |
import { Observable } from 'rxjs'; | |
import { By } from '@angular/platform-browser'; | |
describe('TodoListComponent', () => { | |
// Reference to components we can use in our tests | |
let stub: any = {}, | |
componentFixture: ComponentFixture<TodoListComponent>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Observable, ReplaySubject } from 'rxjs/Rx'; | |
// Dummy class to show mocking without angular2 dependency injection | |
export class AnalyticsService { | |
trackDevices(device) { | |
console.log(device); | |
return device; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DeviceTypeService, AnalyticsService } from './device-type.service'; | |
import { Observable } from 'rxjs'; | |
import { fakeAsync, tick } from '@angular/core/testing'; | |
describe('DeviceTypeService', () => { | |
let stub: any = {}, service: DeviceTypeService; | |
beforeEach(() => { | |
// Create a stub for the analytics service | |
stub.AnalyticsService = jasmine.createSpyObj('AnalyticsService', [ 'trackDevices' ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Modules.Auth.Login.Msg exposing (..) | |
import Http exposing (Error) | |
import Types exposing (User) | |
type LoginMsg | |
= LoginUpdateEmail String | |
| LoginUpdatePassword String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getClickPosition : Model -> Mouse.Position -> Vec3 | |
getClickPosition model pos = | |
let | |
x = | |
toFloat pos.x | |
y = | |
toFloat pos.y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rayTriangleIntersect : Vec3 -> Vec3 -> ( Vec3, Vec3, Vec3 ) -> Maybe Vec3 | |
rayTriangleIntersect rayOrigin rayDirection ( triangle0, triangle1, triangle2 ) = | |
let | |
epsilon = | |
0.000001 | |
edge1 = | |
Vec3.sub triangle1 triangle0 | |
edge2 = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rayTriangleIntersect : Vec3 -> Vec3 -> ( Vec3, Vec3, Vec3 ) -> Maybe Vec3 | |
rayTriangleIntersect rayOrigin rayDirection ( triangle0, triangle1, triangle2 ) = | |
let | |
epsilon = | |
0.000001 | |
edge1 = | |
Vec3.sub triangle1 triangle0 | |
edge2 = |
OlderNewer