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
| const token = 'your-github-token'; | |
| let page; | |
| // getting chunk of users | |
| function getData(since=0) { | |
| return getUsers(since) | |
| .then(data => { | |
| let promises = data.map(({login, repos_url}) => getReposCount(repos_url, login) | |
| .then(count => ({login, count}))); | |
| return Promise.all(promises); |
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
| const request = require('request'); | |
| // sending request | |
| function send_request(Dirty , cb) { | |
| const uri = 'https://www.htmlwasher.com/paste/ajax/'; | |
| const method = 'POST'; | |
| const formData = {Dirty}; | |
| request({ uri, method, formData }, (err, res, body) => { | |
| if (err) { console.log('error:' + err); } | |
| cb(body); | |
| }); |
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
| // angular | |
| import { Injectable } from '@angular/core'; | |
| import { ActivatedRoute, Router } from '@angular/router'; | |
| // ngrx | |
| import { Effect, Actions } from '@ngrx/effects'; | |
| import { Action } from '@ngrx/store'; | |
| import { AppState } from 'app/store/reducers'; | |
| import * as postActions from 'app/sections/store/actions'; | |
| import { SectionService } from '../../services/section.service'; |
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 { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
| import { ActivatedRoute, Router } from '@angular/router'; | |
| import { By } from '@angular/platform-browser'; | |
| import { Component, Input } from '@angular/core'; | |
| import { LoginMenuComponent } from './login-menu.component'; | |
| // rxjs | |
| import { Observable, of } from 'rxjs'; |
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 { RouterModule, Routes } from '@angular/router'; | |
| import { User } from '../_models/index'; | |
| import { UserService } from '../_services/index'; | |
| @Component({ | |
| templateUrl: './protected.component.html' | |
| }) | |
| export class ProtectedComponent implements OnInit { |
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 { AuthenticationService } from '../_services/index'; | |
| @Component({ | |
| templateUrl: './public.component.html' | |
| }) | |
| export class PublicComponent implements OnInit { | |
| constructor(public authenticationService: AuthenticationService) {} | |
| ngOnInit() {} | |
| } |
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 { Router } from '@angular/router'; | |
| import { AuthenticationService } from '../_services/index'; | |
| @Component({ | |
| templateUrl: './login.component.html' | |
| }) | |
| export class LoginComponent implements OnInit { | |
| model: any = {}; |
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 { ProtectedPage } from './protected.po'; | |
| import { PublicPage } from '../public/public.po'; | |
| import { LoginPage } from '../login/login.po'; | |
| describe('protractor-tutorial - Protected page', () => { | |
| let page: ProtectedPage; | |
| let publicPage: PublicPage; | |
| let loginPage: LoginPage; | |
| beforeEach(() => { | |
| page = new ProtectedPage(); | |
| publicPage = new PublicPage(); |
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 { browser, by, element } from 'protractor'; | |
| export class ProtectedPage { | |
| navigateTo() { | |
| return browser.get('/protected'); | |
| } | |
| getPageTitleText() { | |
| return element(by.css('app-root h1')).getText(); | |
| } |
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 { LoginPage } from './login.po'; | |
| import { PublicPage } from '../public/public.po'; | |
| describe('protractor-tutorial - Login page', () => { | |
| let page: LoginPage; | |
| let publicPage: PublicPage; | |
| const wrongCredentias = { | |
| username: 'wrongname', | |
| password: 'wrongpasswd' | |
| }; |