View LocalNugetFolder.pubxml
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<Project> | |
<PropertyGroup> | |
<Configuration>Debug</Configuration> | |
<Platform>Any CPU</Platform> | |
<PublishDir>..\..\..\..\NuGetLocal</PublishDir> | |
<PublishProtocol>FileSystem</PublishProtocol> | |
<TargetFramework>netstandard2.1</TargetFramework> | |
<VersionSuffix>$([System.DateTime]::Now.ToString("yyyyMMddHHmmss"))</VersionSuffix> | |
</PropertyGroup> |
View EnumForEach.cs
This file contains 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
public class Enum<EnumT> where EnumT : Enum | |
{ | |
public static void ForEach(Action<EnumT> action) | |
{ | |
foreach (EnumT status in Enum.GetValues(typeof(EnumT))) | |
action(status); | |
} | |
} |
View check_node_version.js
This file contains 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
const {engines} = require('./package'); | |
// https://github.com/parshap/check-node-version | |
const check = require('check-node-version'); | |
const {execSync} = require('child_process'); | |
check({node: engines.node}, async (error, result) => { | |
if (error) { | |
throw new Error(error); | |
} |
View check_node_version.js
This file contains 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
const { exec } = require("child_process"); | |
const {engines} = require('./package'); | |
exec("npx check-node-version --package", (error, stdout) => { | |
const requiredNodeVersion = engines.node; | |
if (error) { | |
console.error(stdout); | |
exec("node --version", (error, stdout) => { |
View EmailRedactor.cs
This file contains 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
/// <summary> | |
/// Redact/Mask the email address eg: some@gmail.com => s**e@g****.com | |
/// </summary> | |
public class EmailRedactor | |
{ | |
/// <summary> | |
/// eg: "some@gmail.com" => "s**e@g****.com" | |
/// </summary> | |
/// <param name="email"></param> | |
/// <returns></returns> |
View angular-reactive-forms-helper.ts
This file contains 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 { FormGroup, FormControl, FormBuilder, AbstractControl } from '@angular/forms'; | |
export type FormGroupControlsOf<T> = { | |
[P in keyof T]: FormControl | FormGroup; | |
}; | |
export abstract class FormGroupTypeSafe<T> extends FormGroup { | |
//give the value a custom type s | |
value: T; |
View CSVHelperExtentions.cs
This file contains 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
public static class CSVHelperExtentions | |
{ | |
public static string ToCSVString<T>(this IEnumerable<T> objectToConvert) where T : class | |
{ | |
using (var memoryStream = new MemoryStream()) | |
{ | |
var config = new Configuration(); | |
using (var streamWriter = new StreamWriter(memoryStream)) | |
using (var csvWriter = new CsvWriter(streamWriter)) |
View create.cognito.test.user.js
This file contains 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
/* | |
node ./deployment-scripts/create.cognito.test.user.js dev ap-southeast-2_ISEDf22 admin@test.com password123456789 | |
*/ | |
const { region, environment, username, password, userPoolId } = readArguments(); | |
const AWS = require('aws-sdk'); | |
const cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider({ region: region }); | |
if (environment === 'dev' || environment === 'test') { | |
testUser().create$(environment, username, password); |
View reflection-nameof.ts
This file contains 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 Reflection { | |
constructor() { | |
} | |
//If you need more than just a property name eg: full type name try this - https://github.com/dsherret/ts-nameof#nameofto-- | |
static nameOf<T>(propertyFunction: (typeVal: T) => any): string { | |
return /\.([^\.;]+);?\s*\}$/.exec(propertyFunction.toString())[1]; | |
} | |
static nameOfClass<T>(classObject: Function): string { |
View DockerCommands
This file contains 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
Hello world docker container: | |
docker run node -p 8080:3000 -v C:\Repo\nodeDockerVolumeTest:/app -w "/app" node node main.js | |
Connect to bash of docker container: | |
docker run node -p 8080:3000 -it -v C:\Repo\nodeDockerVolumeTest:/app -w "/app" /bin/bash |
NewerOlder