Skip to content

Instantly share code, notes, and snippets.

View michael-wolfenden's full-sized avatar

Michael Wolfenden michael-wolfenden

View GitHub Profile
# Type(<scope>): <subject>
# <body>
# <footer>
# Type should be one of the following:
# * feat (new feature)
# * fix (bug fix)
# * docs (changes to documentation)
# * style (formatting, missing semi colons, etc; no code change)
# * refactor (refactoring production code)
@michael-wolfenden
michael-wolfenden / index.js
Last active October 8, 2015 01:43
Node - Simple round robin load balancer
// cmd> node index.js
// requests to port 8080 will round robin between ports 8081 & 8082
var http = require('http');
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer();
var servers = [
'http://127.0.0.1:8081',
'http://127.0.0.1:8082'
@michael-wolfenden
michael-wolfenden / javascript.json
Last active October 23, 2015 03:35
turbo-javascript snippets for vscode
{
//////////////////////////////////////////////////////////////////////
// ASYNC
//////////////////////////////////////////////////////////////////////
"Node callback": {
"prefix": "cb",
"body": [
"function (err, ${1:value}) {$0}"
]
},
// 2147483647 -> 8fs-Kx
public static class ShortUrl
{
// removed ambiguous characters ('I', 'l', '1', 'O' and '0')
// removed vowels (to prevent offensive words)
public static readonly string Alphabet = "23456789bcdfghjkmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ-_";
public static readonly int Base = Alphabet.Length;
public static string Encode(int toEncode)
{
@michael-wolfenden
michael-wolfenden / TestHelper.cs
Created September 26, 2017 02:32 — forked from sinairv/TestHelper.cs
String Comparison Unit Test Helper
public static class TestHelpers
{
public static void ShouldEqualWithDiff(this string actualValue, string expectedValue)
{
ShouldEqualWithDiff(actualValue, expectedValue, DiffStyle.Full, Console.Out);
}
public static void ShouldEqualWithDiff(this string actualValue, string expectedValue, DiffStyle diffStyle)
{
ShouldEqualWithDiff(actualValue, expectedValue, diffStyle, Console.Out);
@michael-wolfenden
michael-wolfenden / launch.bat
Created October 3, 2017 22:36
ConEmu launch multiple consoles #ConEmu
@echo off
start D:\utils\conEmu\ConEmu64.exe -cmdlist ^
D:\dev\TicketSolutions.OnlineOutlet\src\TicketSolutions.OnlineOutlet.Service\bin\Debug\net461\TicketSolutions.OnlineOutlet.Service.exe -cur_console:f:t:"Outlet-Service" ^|^|^| ^
D:\dev\TicketSolutions.OnlineOutlet\src\TicketSolutions.OnlineOutlet.Web\bin\Debug\net461\TicketSolutions.OnlineOutlet.Web.exe -cur_console:f:t:"Outlet-Web" ^|^|^| ^
D:\dev\TicketSolutions.Bank\src\TicketSolutions.Bank.Service\bin\Debug\net461\TicketSolutions.Bank.Service.exe -cur_console:f:t:"Bank-Service" ^|^|^| ^
D:\dev\TicketSolutions.Bank\src\TicketSolutions.Bank.Web\bin\Debug\net461\TicketSolutions.Bank.Web.exe -cur_console:f:t:"Bank-Web" ^|^|^| ^
D:\dev\TicketSolutions.Reservations\src\TicketSolutions.Reservations.Service\bin\Release\net461\TicketSolutions.Reservations.Service.exe -cur_console:f:t:"Reservations-Service" ^|^|^| ^
D:\dev\TicketSolutions.Fulfillment\src\TicketSolutions.Fulfillment.Service\bin\Release\net461\TicketSolutions.Fulfillment.Service.exe -cur_consol
@michael-wolfenden
michael-wolfenden / create-react-app.ps1
Created October 4, 2017 10:48
Docker create-react-app
docker run -it --rm -v ${PWD}:/src -w /src node:8.6.0-alpine /bin/sh
@michael-wolfenden
michael-wolfenden / Docker shell commands.sh
Created October 15, 2017 10:10 — forked from bahmutov/Docker shell commands.sh
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
@michael-wolfenden
michael-wolfenden / microservice.linq
Last active October 25, 2018 10:43
aspnetcore microservice - linqpad
<Query Kind="Program">
<NuGetReference>Microsoft.AspNetCore</NuGetReference>
<NuGetReference>Microsoft.AspNetCore.Mvc.Core</NuGetReference>
<NuGetReference>Microsoft.AspNetCore.Mvc.Formatters.Json</NuGetReference>
<NuGetReference>System.ValueTuple</NuGetReference>
<Namespace>Microsoft.AspNetCore</Namespace>
<Namespace>Microsoft.AspNetCore.Builder</Namespace>
<Namespace>Microsoft.AspNetCore.Hosting</Namespace>
<Namespace>Microsoft.AspNetCore.Mvc</Namespace>
<Namespace>Microsoft.Extensions.DependencyInjection</Namespace>
@michael-wolfenden
michael-wolfenden / graph.linq
Created October 22, 2017 22:44
Google charts - linqpad
<Query Kind="Program">
<Namespace>System.Globalization</Namespace>
</Query>
void Main()
{
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US"); //Separate double digits with dot not comma - please!
var data = new[] {22.61, 22.59, 22.63, 22.60, 22.62, 22.58, 22.61, 22.62, 22.60, 22.64, 22.69, 22.62, 22.65, 22.62, 22.61, 22.65, 22.63, 22.61, 22.65, 22.63, 22.59, 22.62, 22.59, 22.64, 22.58, 22.61, 22.63, 22.61, 22.61, 22.69, 22.62, 22.59, 22.65, 22.65, 22.64, 22.63, 22.63, 22.63, 22.59, 22.61, 22.67, 22.57, 22.60, 22.61, 22.61, 22.61, 22.60, 22.61, 22.64, 22.62, 22.63, 22.67, 22.65, 22.65, 22.61, 22.63, 22.63, 22.61, 22.62, 22.69, 22.62, 22.59, 22.59, 22.61, 22.61, 22.58, 22.61, 22.65, 22.61, 22.63, 22.68, 22.62, 22.64, 22.62, 22.62, 22.64, 22.64, 22.63, 22.65, 22.61, 22.60, 22.63, 22.59, 22.62, 22.61, 22.59, 22.63, 22.62, 22.60, 22.69, 22.62, 22.61, 22.63, 22.65, 22.64, 22.63, 22.63, 22.65, 22.58, 22.60};
RenderLineGraph("Time", "P1", data);