Skip to content

Instantly share code, notes, and snippets.

git config \
--global \
url."git@github.com".insteadOf \
"https://github.com"
# ---------------------------------------------------------------------
# The first stage container, for building the application
# ---------------------------------------------------------------------
FROM golang:1.12.1-stretch as builder
COPY . /app
# Add the keys
ARG bitbucket_id
ENV bitbucket_id=$bitbucket_id
version: '3.0'
services:
app:
container_name: my_go_app_container
build:
# context can/may/will be different per-project setup
context: ../
dockerfile: GitDockerfile
args:
- bitbucket_id=private_user
@timjonesdev
timjonesdev / ChangeStream.java
Created May 21, 2019 20:28
An example of how to configure a reactive changestream watcher with Spring Boot 2 and Reactive MongoDB
// uses Spring Boot 2, Spring Webflux, Reactive Mongo Repository
public class ChangeStream {
@Autowired
private ReactiveMongoTemplate reactiveMongoTemplate;
public Flux<SampleDao> watchChanges() {
// set changestream options to watch for any changes to the sample collection
ChangeStreamOptions options = ChangeStreamOptions.builder()
.filter(Aggregation.newAggregation(SampleDao.class,
@timjonesdev
timjonesdev / teams_initial.bson
Last active May 28, 2019 23:32
Some initial sample data for the reactive mongo streams example.
[
{
"_id": ObjectId("5cb96b9132ac9751f3ff1912"),
"nickname": "HingleMcCringleberry",
"owner": "John S."
},
{
"_id": ObjectId("5cb96b9132ac9751f3ff1892"),
"name": "Johnny Utah",
"owner": "Paul M."
Date: 2019-06-26T17:07:41.247Z
Hash: c58e049a483cf92093f5
Time: 18085ms
chunk {0} runtime-es5.741402d1d47331ce975c.js (runtime) 1.41 kB [entry] [rendered]
chunk {1} main-es5.4af9b61479361f268d39.js (main) 128 bytes [initial] [rendered]
chunk {2} polyfills-es5.0abd2975e5ae858be8b6.js (polyfills) 68.1 kB [initial] [rendered]
chunk {3} styles.ff23229eb61c8a3d0e74.css (styles) 62.4 kB [initial] [rendered]
ERROR in : Unexpected value 'undefined' imported by the module 'MyModule in /build/src/node_modules/my-lib/my-lib.d.ts'
@timjonesdev
timjonesdev / my-lib-bad.module.ts
Last active June 27, 2019 20:24
The incorrect way to import modules for an Angular Library
import {NgModule} from '@angular/core';
import {MyLibComponent} from './my-lib.component';
import {NavigationModule} from "./navigation"; // <-- too short for library module
import {FormModule} from "./form"; // <-- too short for library module
@NgModule({
declarations: [MyLibComponent],
imports: [NavigationModule, FormModule],
exports: [NavigationModule, FormModule]
})
@timjonesdev
timjonesdev / my-lib-good.module.ts
Last active June 27, 2019 20:24
The correct way to import modules in an Angular library
import {NgModule} from '@angular/core';
import {MyLibComponent} from './my-lib.component';
import {NavigationModule} from "./navigation/navigation.module"; // <-- lengthened
import {FormModule} from "./form/form.module"; // <-- lengthened
@NgModule({
declarations: [MyLibComponent],
imports: [NavigationModule, FormModule],
exports: [NavigationModule, FormModule]
})
@timjonesdev
timjonesdev / docker-cleanup.sh
Created June 29, 2019 04:42
A cleanup script for docker resources, if you don't have `docker system prune` available. WARNING: This will delete all containers, images, and volumes.
#!/usr/bin/env bash
echo "Running docker cleanup script"
echo "Stopping all containers"
docker stop $(docker ps -a -q) # Stop all containers
echo "Removing stopped containers"
docker rm $(docker ps -a -q) # Remove all stopped containers
@timjonesdev
timjonesdev / MongoFirstDockerfile
Created August 16, 2019 04:19
The first draft of the Mongo Dockerfile
FROM mongo:4.0
# files used to initialize the database
COPY ./init-db.d/ /docker-entrypoint-initdb.d