Skip to content

Instantly share code, notes, and snippets.

View linhx's full-sized avatar

Nguyen Dinh Linh linhx

View GitHub Profile
@linhx
linhx / leaflet.mock.api.js
Created April 24, 2023 09:53
leaflet-1.5.1-mocks: This file for avoiding the error "Uncaught ReferenceError: L is not defined" when when running your Karma tests
// eslint-disable
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.L = {})));
}(this, (function (exports) {
'use strict';
var version = "1.5.1+HEAD.2e3e0ff";
var freeze = Object.freeze;
Object.freeze = function (obj) {
@linhx
linhx / sqlserver-clonetable.sql
Last active October 21, 2021 02:53
SQL Server clone table: clone columns, contraints, default values
CREATE PROCEDURE [dbo].[spCloneTableStructure]
@SourceSchema nvarchar(255),
@SourceTable nvarchar(255),
@DestinationSchema nvarchar(255),
@DestinationTable nvarchar(255),
@RecreateIfExists bit = 0
AS
BEGIN
SET NOCOUNT ON;
@linhx
linhx / application.properties
Created September 27, 2021 09:29
Spring boot Log4j2 config for rolling file
# logging
log.folder=./log-folder
log.file.rolling.maxsize=10MB
@linhx
linhx / 1. typeorm-0.3.6-dynamic-table-name.md
Last active April 24, 2023 10:06
Working with dynamic table name with TypeOrm (test with ver 0.2.30 and 0.3.6)
@linhx
linhx / winston-formater.ts
Last active November 9, 2021 04:54
Winston formater
import * as winston from 'winston';
import safeStringify from 'fast-safe-stringify';
const { combine, timestamp, errors, printf } = winston.format;
// tslint:disable-next-line:no-shadowed-variable
const format = printf(({ timestamp, level, label, message, stack, ...others }:
{ timestamp: string, level: string, label: string, message: any, stack: any, others: { [key in symbol]: string } }) => {
const namespace = label ? `(${label})` : '';
const errStack = stack ? `\n${stack}` : '';