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(index). | |
| -export([create/1]). | |
| % Given a file name, returns the sorted index with | |
| % entries that look like | |
| % | |
| % { "foo" , [{3,5},{7,7},{11,13}] } | |
| % | |
| -spec create(string()) -> [{string(), [{integer(), integer()}]}]. | |
| create(Name) -> |
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(index). | |
| -export([ | |
| lines_from_contents/1, | |
| get_file_contents/1, | |
| show_file_contents/1, | |
| basic_index_from_lines/1, | |
| intermediate_index/1, | |
| final_index/1]). | |
| % C = index:get_file_contents("gettysburg-address.txt"). |
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(index). | |
| -export([ | |
| lines_from_contents/1, | |
| get_file_contents/1, | |
| show_file_contents/1, | |
| basic_index_from_lines/1, | |
| intermediate_index/1, | |
| final_index/1]). | |
| % C = index:get_file_contents("gettysburg-address.txt"). |
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
| g/_/ s/./\l&/g | s/_\(.\)/\u\1/g |
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
| that depends on you use case, but a Map[Key, List[Value]] could work if you need key lookup | |
| a more typesafe alternative would be a Map[Key, NonEmptyList[Value]], but you'd have to get the NonEmptyList from somewhere else | |
| the simplest would be just something like a List[(Key, Value)] | |
| you could also look in to a Vector[(Key, Value)] sorted by key so you can binary search on it and such | |
| Options aplenty |
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
| npm install -g @angular/cli | |
| ng help | |
| ng new myboiler-prototype | |
| cd myboiler-prototype | |
| ng serve | |
| ng serve --host 0.0.0.0 --port 4201 | |
| http://www.protractortest.org/#/ | |
| npm install -g --dev-save protractor |
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
| export class User { | |
| constructor( | |
| public id: string, | |
| public name: string, | |
| public username: string, | |
| public email: 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
| import { Injectable } from '@angular/core'; | |
| import { Http, Response } from '@angular/http'; | |
| import { Observable } from 'rxjs/Rx'; | |
| import { User } from "app/models/user"; | |
| @Injectable() | |
| export class UserService { | |
| constructor(private http: Http) { | |
| } | |
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 { BrowserModule } from '@angular/platform-browser'; | |
| import { NgModule } from '@angular/core'; | |
| import { FormsModule } from '@angular/forms'; | |
| import { HttpModule } from '@angular/http'; | |
| import { AppComponent } from './app.component'; | |
| import { UserService } from "app/services/user.service"; | |
| @NgModule({ | |
| declarations: [ |
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
| <div> | |
| <ul> | |
| <li *ngFor="let user of users | async">{{user.name}}</li> | |
| </ul> | |
| </div> |