This came from this post Angular apps created using angular-cli will have src/environments directory. 1. Add another file in there called environment.staging.ts with the following entry... export const environment = { production: false, envName: 'staging' }; 2. Modify .angular.cli.json "environments": { "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts", "staging": "environments/environment.staging.ts" } 3. Now when creating a build or serving the app.. $ ng build -prod $ ng build -staging $ ng serve -prod $ ng serve -staging 4. To use... import { environment } from './environment'; export class MyappAppComponent { title = 'myapp works!'; environmentName = environment.envName; }
9.21.2017
Angular Development Production Settings
9.13.2017
VS Code Cheat Sheet
Full list of shortcuts
1. Detach file to another window ⌘K, O 2. Format file ⇧ + Opt + F 3. Preview side-by-side ⌘K, V 4. Screen shot ⇧⌘3 - whole screen ⇧⌘4 - selection
9.08.2017
Celery Tasks Parallel and Chained Execution Workflow
In celery, it is very easy to chain and parallelize execution of tasks, e.g. to satisfy this example workflow...
_____ |task1| 1. exec task1 / \ __/__ __\__ |task2| |task3| 2. parallel task1 & task2 \ / \ _____/ |task4| 3. exec task4 when both task1 & task2 are done
from celery import chain, group, chord from orchestrator.tasks.host_tasks import acquire_hosts, prepare_hosts, return_hosts from orchestrator.tasks.job_tasks import start_job, stop_job from orchestrator.tasks.vcenter_tasks import acquire_vcenter, return_vcenter def start_performance_run_workflow(job_id): print('Starting performance run workflows for job %s' % job_id) # The effect of this chain, is that only the first one is routed # to the "regular.priority" queue # subsequent tasks are routed to "celery" default queue workflow = chain( acquire_hosts.si(job_id), chord( (prepare_hosts.si(job_id), acquire_vcenter.si(job_id)), start_job.si(job_id) ) ).apply_async(queue="regular.priority")
Angular Material Table Dynamic Height
For md-table, the height can be dynamically adjusted this way...
1. sample-table.component.html <div class="example-container mat-elevation-z8" [style.max-height.px]="tableHeight"> ... <md-table #table [dataSource]="dataSource" mdSort> 2. sample-table.component.ts import { HostListener } from '@angular/core'; export class SampleTableComponent { tableHeight: number; ngOnInit() { this.tableHeight = window.innerHeight - 90; } @HostListener('window:resize', ['$event']) onWindowResize(event){ this.tableHeight = event.target.innerHeight - 90; console.log("height: " + this.tableHeight ); }
Subscribe to:
Posts (Atom)