Skip to content

Instantly share code, notes, and snippets.

import { ReactiveFormsModule } from '@angular/forms';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule, ReactiveFormsModule,
ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
],
import { FormBuilder } from '@angular/forms';
constructor(public fb: FormBuilder) { }
curtomerForm: FormGroup;
constructor(public fb: FormBuilder) { }
ngOnInit() {
this.customerForm= this.fb.group({
firstName: [''],
lastName: [''],
mobiles: this.fb.array([this.buildNumber()])
});
<mat-card>
<mat-card-content>
<form class="example-form" [formGroup]="customerForm">
<mat-form-field class="example-full-width">
<input type="text" matInput formControlName="firstName" placeholder="FirstName">
</mat-form-field>
<mat-form-field class="example-full-width">
<input type="text" matInput formControlName="lastName" placeholder="Last Name">
</mat-form-field>
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/of';
export interface ICustomer {
firstName: string;
lastName: string;
mobile: IMobile[];
}
export interface IMobile {
number: string;
this.data.getCustomer().subscribe(res => {
console.log(res[0]);
this.customerForm.patchValue({
firstName: res[0].firstName,
lastName: res[0].lastName
});
for (let index = 0; index < res[0].mobile.length; index++) {
this.mobiles.controls.push(this.buildNumber());
this.mobiles.at(index).patchValue({
#Find character secuences including overlapping matches
s = "azcbobobegghakl"
p=[i for i in range(len(s)) if s.startswith('bob', i)]
print(p);
print(len(p))
# Reading list
#Recommend Reading
# https://docs.python.org/3/tutorial/datastructures.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sign In with Auth0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<style>
var auth0 = new auth0.WebAuth({
clientID: environment.auth0.client_id,
domain: environment.auth0.domain,
responseType: environment.auth0.responseType,
audience: environment.auth0.audience,
redirectUri: environment.auth0.callbackurl,
scope: environment.auth0.scope,
});
const params = {
# Generate Token
# https://auth0.com/docs/api/authentication#client-credentials
curl --request POST \
--url 'https://tanver.au.auth0.com/oauth/token' \
-H 'content-type: application/json' \
-d '{"grant_type":"client_credentials","client_id": "[client id]","client_secret": "[client secret]","audience": "https://[domain].auth0.com/api/v2/"}'
#Find Connection
# https://auth0.com/docs/api/management/v2#!/Connections/get_connections