One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
sudo curl -o /usr/local/bin/imgcat -O https://raw.githubusercontent.com/gnachman/iTerm2/master/tests/imgcat && sudo chmod +x /usr/local/bin/imgcat | |
# If you have a better way to fix the permissions, comment below! |
# Shorthand Git CLI syntax + better git log | |
# Better git log | |
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative" | |
function gs { | |
git status | |
} | |
function gd { |
In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.
This is how the demonstration will load data:
a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';
b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.
-- Remove the history from | |
rm -rf .git | |
-- recreate the repos from the current content only | |
git init | |
git add . | |
git commit -m "Initial commit" | |
-- push to the github remote repos ensuring you overwrite history | |
git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git |
import { Action, ActionReducer, Store } from '@ngrx/store'; | |
import { BehaviorSubject } from 'rxjs/BehaviorSubject'; | |
import { Observable } from 'rxjs/Observable'; | |
import { map } from 'rxjs/operator/map'; | |
import { Observer } from 'rxjs/Observer'; | |
// TODO: How to initialize those variables? | |
const dispatcherMock: Observer<Action>, | |
reducerMock: Observer<ActionReducer<any>>, | |
stateMock: Observable<any>; |
import { Injectable } from '@angular/core'; | |
import { Router, NavigationEnd } from '@angular/router'; | |
@Injectable() | |
export class PreviousRouteService { | |
private previousUrl: string; | |
private currentUrl: string; | |
constructor(private router: Router) { |
This recipe is useful for cooking up chained API calls as a result of a single action.
In the below example, a single action called POST_REPO
is dispatched and it's intention is to create a new repostiory on GitHub then update the README with new data after it is created.
For this to happen there are 4 API calls necessary to the GitHub API:
@Effect({dispatch: false}) | |
entityCreationSuccess$: Observable<Action> = this.actions$.pipe( | |
ofType(UserActions.CREATE_USER_SUCCESS, PostActions.CREATE_POST_SUCCESS), | |
tap(action => { | |
this.router.navigate(['../'], {relativeTo: this.route}) | |
}) | |
); |
interface IUserState { | |
"users": IUser[], | |
"selected_user": IUser, | |
"sort": ISort | |
} | |
const initial_state: IState { | |
"users": [], | |
"selected_user": {}, |