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
npx -p @angular/cli ng new hello-world-project | |
then locally can run | |
npx ng g c hello-world-component | |
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
/** | |
* Better DateTimeFormatOptions types | |
* | |
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat for representation details | |
*/ | |
export interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions { | |
localeMatcher?: 'best fit' | 'lookup'; | |
weekday?: 'long' | 'short' | 'narrow'; | |
era?: 'long' | 'short' | 'narrow'; | |
year?: 'numeric' | '2-digit'; |
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
// Simple node file to remove fill attribute from svg (for using in angular, mat icon, or other...) | |
// External libraries needed: "xmldoc": "^1.1.2" | |
const fs = require('fs'); | |
const xmldoc = require('xmldoc'); | |
const removeFillAttrRecursively = (node)=> { | |
if(node?.attr?.fill){ | |
delete node.attr.fill; | |
} |
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
/** | |
The corvid doc api is not correct | |
Actually using the doc we get | |
Error message: "No coupon type" | |
Here is the code to fix this: | |
*/ | |
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 {Request, Response} from "express"; | |
import { | |
Collection, | |
DeleteWriteOpResultObject, | |
InsertOneWriteOpResult, | |
MongoClient, | |
ObjectID, | |
UpdateWriteOpResult | |
} from "mongodb"; | |
import {dbConf} from "../config"; |
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 * as mysql from "mysql"; | |
import {MysqlError, Pool, PoolConnection} from "mysql"; | |
import {dbMysqlConf} from "./config"; | |
const MAX_ATTEMPS = 10; | |
let attempts = 0; | |
export const managePoolConnection = (app:any) => new Promise((resolve: (status:string) => void, reject: (status:string) => void) => { | |
let pool: Pool = mysql.createPool(dbMysqlConf); |
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
[Unit] | |
Description=docker-wordpress | |
Requires=docker.service | |
After=docker.service | |
[Service] | |
Restart=always | |
WorkingDirectory=/home/dfa1324/docker-wordpress |
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
version: '3.3' | |
services: | |
db: | |
image: mariadb:latest | |
volumes: | |
- ./db_data:/var/lib/mysql | |
ports: | |
- "3308:3306" | |
restart: always |
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
export class AngularIndexedDB { | |
utils: Utils; | |
dbWrapper: DbWrapper; | |
constructor(dbName: string, version: number) { | |
this.utils = new Utils(); | |
this.dbWrapper = new DbWrapper(dbName, version); | |
} | |
openDatabase(version: number, upgradeCallback?: Function) { |
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 { ModuleWithProviders, NgModule } from '@angular/core'; | |
import { CommonModule } from '@angular/common'; | |
import { Injectable, Inject } from '@angular/core'; | |
import * as WooCommerceAPI from 'woocommerce-api'; | |
//For exporting the service: | |
//import { WooApiService } from './src/woocommerce.service'; | |
//export * from './src/woocommerce.service'; |
NewerOlder