Skip to content

Instantly share code, notes, and snippets.

engineersamuel /
Last active Mar 10, 2020
Managing remote docker-compose with Azure DevOps Deployment Groups


This blog will detail how to manage remote docker-compose instances with Azure Devops Deployment groups.

I'm going through as a template.

I'm using AzureDevops, when I signed up it automatically created a project {FirstName}{LastName} for me.

Under Pipelines click Deployment Groups and create a new Deployment Group. You'll need to copy the script and run it on the machine in question. That could be a VM, for this blog I'm testing on my personal laptop.

engineersamuel /
Last active Jan 16, 2020
Long-term caching GraphQL queries with Webpack


When using Apollo Graphql in the front-end, there is no established pattern to separate out your graphql queries into separate files instead of bundled with the js assets. I've searched and tried many various ways, including webpack file-loader and even modifying file-loader. Actually file-loader will separate it out but it returns a url that points to the filesystem which is not easily consumed. The answer is actually strangly obvious once you see the solution.

TL&DR: If you want to skip ahead to the configuration see What worked at the bottom.

The goal being, having some directory structure like:

  • src
    • graphql
      • users.query.graphql
View index.snippet.html
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: 'http://localhost:7071/api/swagger/openapi.json', oauth2RedirectUrl: 'http://localhost:7071/api/swagger/oauth2-redirect.html',
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
View local.settings.json
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"Host": {
"LocalHttpPort": 7071,
"CORS": "*"
View swaggerSnippet.js
const ui = SwaggerUIBundle({
url: "",
View Swagger.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using CseApi.Functions.Shared;
using CseApi.Helpers.Config;
using CseApi.Helpers.Http;
using Microsoft.AspNetCore.Http;
engineersamuel / event.hooks.js
Created May 21, 2018
Webpack event hook to rewrite index.html
View event.hooks.js
new EventHooksPlugin({
'afterEmit': () => {
const hashedIndexHtml = glob.sync(`${paths.appBuild}/*.html`)[0];
const hash = /index\.(.*?)\.html/.exec(hashedIndexHtml)[1];
const webConfig = fs.readFileSync(`${paths.appBuild}/web.config`).toString();
const result = webConfig.toString().replace(/index\.html/g, `index.${hash}.html`);
fs.writeFileSync(`${paths.appBuild}/web.config`, result);
engineersamuel / web.config.xml
Created May 21, 2018
Azure IIS static web.config
View web.config.xml
<?xml version="1.0" encoding="UTF-8"?>
<add value="index.html" />
View action_reducer_do_this.ts
interface IActionUpdateProductNameVersion {
productName: string;
productVersion: string;
const requestUpdateProductVersion = createAction<interfaces.IActionUpdateProductNameVersion, void>(types.REQUEST_UPDATE_PRODUCT_VERSION,
(productName: string, productVersion: string) => ({productName, productVersion}),
const receiveUpdateProductVersion = createAction<interfaces.IActionUpdateProductNameVersion, interfaces.IMetaIsXhrError>(types.RECEIVE_UPDATE_PRODUCT_VERSION,