Skip to content

Instantly share code, notes, and snippets.

Jonathan Campos jonbcampos

Block or report user

Report or block jonbcampos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View medium_configmaps_and_secrets_p1.yaml
env:
- name: NODE_ENV
valueFrom:
configMapKeyRef:
name: basic-config # name of the configmap
key: NODE_ENV # key within the configmap
- name: SOME_VALUE
valueFrom:
configMapKeyRef:
name: basic-config
View kubernetes-series_secrets_k8s_basic-config.yaml
apiVersion: v1
kind: ConfigMap # it is a config map
data: # key value pairs
NODE_ENV: "production"
SOME_VALUE: "my config value"
metadata:
name: basic-config # name to reference
View medium_asynchronous_schematics_p3.ts
function waitingRule(options: any): Rule {
return (host: Tree) => {
const observer = new Observable<Tree>((observer) => {
fetch('someUrl.com/') // any async operation
.then(res => res.json())
.then(data => {
observer.next(host);
observer.complete();
})
.catch(function (err: any) {
View medium_asynchronous_schematics_p2.ts
function myCustomRule(options: any): Rule {
return (host: Tree) => {
return host;
}
}
View medium_asynchronous_schematics_p1.ts
const rule = chain([
rule1,
rule2,
rule3
]);
return rule(host, context);
View medium_integrating_with_other_schematics_p5.json
{
"$schema": "http://json-schema.org/schema",
"id": "SchematicsMaterialInstall",
"title": "Material Install Options Schema",
"type": "object",
"properties": {
"skipPackageJson": {
"type": "boolean",
"default": false,
"description": "Do not add materials dependencies to package.json (e.g., --skipPackageJson)"
View medium_integrating_with_other_schematics_p4.json
{
"$schema": "./node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
// Adds Angular Material to an application without changing any templates
"ng-add": {
"description": "Adds Angular Material to the application without affecting any templates",
"factory": "./install",
"schema": "./install/schema.json",
"aliases": ["material-shell"] # <-- name/alias of Schematic
},
View medium_integrating_with_other_schematics_p3.ts
// within template chain
...,
options.uiFramework === UI_FRAMEWORK_OPTION.MATERIAL ?
externalSchematic('@angular/material', 'material-shell', {
project: options.project
}) : noop(),
...
View medium_integrating_with_other_schematics_p2.ts
// DON'T DO THIS
options.skipVo ? noop() : schematic("vo", {
project: options.project,
path: options.path,
name: options.vo,
spec: options.spec,
obj: options.obj
}),
// DO THIS
You can’t perform that action at this time.