Skip to content

Instantly share code, notes, and snippets.

@aheuermann
aheuermann / dual-fk-join.md
Last active December 14, 2020 17:16
Dual-FK Join Example

We do change-data-capture using debezium on our main database. These changes are written to kafka. We have a use-case for something along these lines:

Inputs:

users_teams

What users belong to what teams (users can belong to multiple teams).

  • id String (key)
  • user_id String
  • group_id String
@aheuermann
aheuermann / create_connection.py
Created September 1, 2017 00:45 — forked from nathairtras/create_connection.py
creating airflow connections via python
from airflow import settings
from airflow.hooks import BaseHook
from airflow.models import Connection
# Start a session
session = settings.Session()
# Create a new connection - these are not unique by name!
cnx_kwargs = {
"conn_id": "mssql_named",
@aheuermann
aheuermann / Jenkinsfile
Created October 25, 2016 07:27
Jenkins Pipeline Parallel Test Example
node {
stage('Preparation') { // for display purposes
// Get some code from a GitHub repository
git 'https://github.com/dotci-test/test1.git'
}
stage('Build') {
// Run the build
if (isUnix()) {
sh "'docker-compose' build --pull"
} else {
// promise handles user not found by returing `null`
// advantage - don't have to write a reject handler
// disadvantage - possibly forget to write `null` check and cause null pointer exception
function checkEmail(emailAddress) {
return facade.user.getUserByEmailAddress(emailAddress).chain(function (user) {
if (!user) {
return {available: true};
}
return facade.user.isUserAnInvitedTaker(user).chain(function (isInvited) {
@aheuermann
aheuermann / error_api.js
Last active March 30, 2016 23:55
Not Found Error vs Return Null w/ handlers
var facade = require('facade'),
handlers = require('handlers');
app.use("/verification/:verificationId", funciton (req, res) {
facade.getUserForVerificationId(req.params.verificationId)
.then(handlers.successHandler, handlers.errorHandler);
});

Keybase proof

I hereby claim:

  • I am aheuermann on github.
  • I am aheuermann (https://keybase.io/aheuermann) on keybase.
  • I have a public key whose fingerprint is 9A47 2568 C1E0 F13C 3642 2B09 3D0D 3031 90DD 2E9A

To claim this, I am signing this object:

@aheuermann
aheuermann / node_unknown_error.js
Created November 24, 2015 22:21
Debugging Unknown/Unhandled Node Exception
process.on('uncaughtException', function(err) {
console.log("uncaughtException:", err && err.stack);
});
process.on('exit', function() {
console.log("exit", arguments, new Error().stack);
});
@aheuermann
aheuermann / .ci.yml
Last active November 6, 2015 00:41
DotCi using COMPOSE_PROJECT_NAME
before: before.sh
run:
node: "grunt test"
golang: "go test -v ./..."
@aheuermann
aheuermann / err.go
Last active August 29, 2015 14:04
Simple Go Error with Stacktrace
package err
import (
"fmt"
"runtime/debug"
)
type Err struct {
errorWithStack string
}
Install XCode & Command Line Tools (Use the App Store)
Install Git - http://git-scm.com/download/mac
Follow these instructions: https://help.github.com/articles/generating-ssh-keys
# Installing Homebrew
open Terminal
cd ~
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
brew update
brew edit play