Skip to content

Instantly share code, notes, and snippets.

@angular-academy-devs
Last active August 15, 2017 10:36

Revisions

  1. angular-academy-devs revised this gist Jul 19, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions angular-fire-install.ts
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,8 @@
    imports: [
    BrowserModule,
    AngularFireModule.initializeApp(firebaseConfig),
    AngularFireDatabaseModule,
    AngularFireAuthModule,
    RouterModule.forRoot(routerConfig)
    ],
    providers: [...],
  2. angular-academy-devs revised this gist Jul 19, 2017. 2 changed files with 3 additions and 3 deletions.
    4 changes: 2 additions & 2 deletions angular-fire-firebase-sdk.ts
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    import {FirebaseRef} from "angularfire2";
    import {FirebaseApp} from "angularfire2";

    @Injectable()
    export class LessonsService {

    constructor( @Inject(FirebaseRef) fb) {
    constructor( @Inject(FirebaseApp) fb) {

    const rootDbRef = fb.database().ref();

    2 changes: 1 addition & 1 deletion read-nodes-example.ts
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    constructor( @Inject(FirebaseRef) fb) {
    constructor( @Inject(FirebaseApp) fb) {

    const rootDbRef = fb.database().ref();

  3. angular-academy-devs revised this gist Oct 14, 2016. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions firebase-queue-consumer.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    console.log("Running consumer ...");

    const lessonsRef = database().ref("lessons");
    const lessonsPerCourseRef = database().ref("lessonsPerCourse");

    const queueRef = database().ref('queue');

    const queue = new Queue(queueRef, function(data, progress, resolve, reject) {

    console.log('received delete request ...',data);

    ... complex business logic goes here ...

    });

  4. angular-academy-devs revised this gist Oct 14, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions delete-request.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    requestLessonDeletion(lessonId:string, courseId:string) {
    this.db.child('queue/tasks').push({lessonId,courseId})
    .then(
    () => alert('lesson deletion requested !')
    );
    }
  5. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions courses-json.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    {
    "-KT_udWMM0vKlnp-naE3": {
    "courseListIcon": "https://angular-academy.s3.amazonaws.com/main-logo/main-page-logo-small-hat.png",
    "description": "Angular 2 Tutorial For Beginners",
    "iconUrl": "https://angular-academy.s3.amazonaws.com/thumbnails/angular2-for-beginners.jpg",
    "longDescription": "Establish a solid layer of fundamentals, learn what's under the hood of Angular 2",
    "url": "getting-started-with-angular2"
    },
    "-KT_udWj0knDpxHaxcKv": {
    "courseListIcon": "https://angular-academy.s3.amazonaws.com/course-logos/observables_rxjs.png",
    "description": "Angular 2 HTTP and Services",
    "iconUrl": "https://angular-academy.s3.amazonaws.com/thumbnails/services-and-http.jpg",
    "longDescription": "<p class='course-description'>Build Services using Observables, learn to use the HTTP module effectively.",
    "url": "angular2-http"
    }
    }
  6. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions auth.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    import {firebaseConfig} from "./src/environments/firebase.config";
    import {initializeApp, auth,database} from 'firebase';

    initializeApp(firebaseConfig);

    auth()
    .signInWithEmailAndPassword('[email protected]', 'test123')
    .then(onLoginSuccess)
    .catch(onLoginError);

    function onLoginSuccess() {
    ...
    }

    function onLoginError() {
    ...
    }

  7. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions save-data-angular-fire.ts
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,3 @@


    courses$.push({description: 'New Course'})
    .then(
    () => console.log('item added'),
  8. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion save-data-angular-fire.ts
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,5 @@ courses$.push({description: 'New Course'})
    .then(
    () => console.log('item added'),
    console.error
    );
    );

  9. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions save-data-angular-fire.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@


    courses$.push({description: 'New Course'})
    .then(
    () => console.log('item added'),
    console.error
    );
  10. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions read-object.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    findLessonById(lessonId:string):Observable<Lesson> {
    return this.db.object(`lessons/${lessonId}`)
    .map(Lesson.fromJson);
    }

  11. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 21 additions and 0 deletions.
    21 changes: 21 additions & 0 deletions angular-fire-list.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    import {Injectable} from '@angular/core';
    import {Observable, Subject} from "rxjs/Rx";
    import {Lesson} from "./lesson";
    import {AngularFireDatabase} from "angularfire2";


    @Injectable()
    export class LessonsService {

    constructor(private db:AngularFireDatabase) {
    }

    findAllLessons():Observable<Lesson[]> {
    return this.db.list('lessons')
    .do(console.log)
    .map(Lesson.fromJsonList);
    }

    }


  12. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion read-nodes-example.ts
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ constructor( @Inject(FirebaseRef) fb) {
    snap => console.log('Received the whole courses node',snap.val()) );

    rootDebRef.child('lessons/-KT_udWS6pEmpLVrxlVw:').on('value',
    snap => console.log('Received the whole courses node',snap.val()) );
    snap => console.log('Received lesson with a given Id',snap.val()) );

    }

  13. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion read-nodes-example.ts
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@ constructor( @Inject(FirebaseRef) fb) {

    const rootDbRef = fb.database().ref();

    rootDebRef.child('courses').on('value', snap => console.log('Received the whole courses node',snap.val()) );
    rootDebRef.child('courses').on('value',
    snap => console.log('Received the whole courses node',snap.val()) );

    rootDebRef.child('lessons/-KT_udWS6pEmpLVrxlVw:').on('value',
    snap => console.log('Received the whole courses node',snap.val()) );
  14. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions read-nodes-example.ts
    Original file line number Diff line number Diff line change
    @@ -8,3 +8,4 @@ constructor( @Inject(FirebaseRef) fb) {
    snap => console.log('Received the whole courses node',snap.val()) );

    }

  15. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions read-nodes-example.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    constructor( @Inject(FirebaseRef) fb) {

    const rootDbRef = fb.database().ref();

    rootDebRef.child('courses').on('value', snap => console.log('Received the whole courses node',snap.val()) );

    rootDebRef.child('lessons/-KT_udWS6pEmpLVrxlVw:').on('value',
    snap => console.log('Received the whole courses node',snap.val()) );

    }
  16. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions angular-fire-firebase-sdk.ts
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,8 @@ export class LessonsService {

    const rootDbRef = fb.database().ref();

    rootDebRef.on('value', snapshot => console.log(snapshot.val()));

    ...
    }

  17. angular-academy-devs renamed this gist Oct 13, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  18. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    import {FirebaseRef} from "angularfire2";

    @Injectable()
    export class LessonsService {

    constructor( @Inject(FirebaseRef) fb) {

    const rootDbRef = fb.database().ref();

    ...
    }

    }

  19. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion angular-fire-install.ts
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    ],
    imports: [
    BrowserModule,
    AngularFireModule.initializeApp(firebaseConfig, authConfig),
    AngularFireModule.initializeApp(firebaseConfig),
    RouterModule.forRoot(routerConfig)
    ],
    providers: [...],
  20. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions angular-fire-install.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    @NgModule({
    declarations: [
    AppComponent,
    ...
    ],
    imports: [
    BrowserModule,
    AngularFireModule.initializeApp(firebaseConfig, authConfig),
    RouterModule.forRoot(routerConfig)
    ],
    providers: [...],
    bootstrap: [AppComponent]
    })
    export class AppModule { }

  21. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions read-whole-db.ts
    Original file line number Diff line number Diff line change
    @@ -11,3 +11,5 @@ export const firebaseConfig = {
    initializeApp(firebaseConfig);

    database().ref().on('value', snapshot => console.log(snapshot.val()));


  22. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions read-whole-db.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    import {initializeApp,database} from 'firebase';

    export const firebaseConfig = {
    apiKey: "AIzaSyA0BcUcu4V8aHT_gM-32BhRcmqji4z-xts",
    authDomain: "some-app.firebaseapp.com",
    databaseURL: "https://some-app.firebaseio.com",
    storageBucket: "some-app.appspot.com",
    messagingSenderId: "290354329699"
    };

    initializeApp(firebaseConfig);

    database().ref().on('value', snapshot => console.log(snapshot.val()));
  23. angular-academy-devs revised this gist Oct 13, 2016. 1 changed file with 27 additions and 0 deletions.
    27 changes: 27 additions & 0 deletions one-to-many-wrong.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    {
    "url": "angular2-hello-world-write-first-application",
    "description": "Angular 2 Tutorial For Beginners - Build Your First App - Hello World Step By Step",
    "duration": "2:49",
    "tags": "BEGINNER",
    videoUrl: "https://www.youtube.com/embed/du6sKwEFrhQ",
    "longDescription": "This is step by step guide to create your first Angular 2 application. Its aimed at beginners just starting out with the framework.This lesson will show how to create a component, and how to link the component to a given custom HTML tag. It will show how to give the component a given template."
    lessons: [
    {
    "url": "angular2-hello-world-write-first-application",
    "description": "Angular 2 Tutorial For Beginners - Build Your First App - Hello World Step By Step",
    "duration": "2:49",
    "tags": "BEGINNER",
    videoUrl: "https://www.youtube.com/embed/du6sKwEFrhQ",
    "longDescription": "This is step by step guide to create your first Angular 2 application. Its aimed at beginners just starting out with the framework.This lesson will show how to create a component, and how to link the component to a given custom HTML tag. It will show how to give the component a given template."
    },
    {
    "url": "angular2-build-your-first-component",
    "description": "Building Your First Angular 2 Component - Component Composition",
    "duration": "2:07",
    "tags": "BEGINNER",
    videoUrl: "https://www.youtube.com/embed/VES1eTNxi1s",
    "longDescription": "In this lesson we are going to see how to include a component inside another component. We are going to create a simple search box component and include it in our main application."
    },
    ...
    ]
    }
  24. angular-academy-devs revised this gist Oct 13, 2016. No changes.
  25. angular-academy-devs created this gist Oct 13, 2016.
    8 changes: 8 additions & 0 deletions lesson.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    {
    "url": "angular2-hello-world-write-first-application",
    "description": "Angular 2 Tutorial For Beginners - Build Your First App - Hello World Step By Step",
    "duration": "2:49",
    "tags": "BEGINNER",
    videoUrl: "https://www.youtube.com/embed/du6sKwEFrhQ",
    "longDescription": "This is step by step guide to create your first Angular 2 application. Its aimed at beginners just starting out with the framework.This lesson will show how to create a component, and how to link the component to a given custom HTML tag. It will show how to give the component a given template."
    }