Skip to content

Instantly share code, notes, and snippets.

View ttristan's full-sized avatar

Tristan Schlötel ttristan

  • Düsseldorf
View GitHub Profile
@ttristan
ttristan / .docker config.json
Last active May 26, 2022 13:03
short docker ps format
{
"credsStore": "desktop",
"_psFormat": "table {{ .ID }}\t{{.Names}}\t{{.Status}}\t{{.Ports}}",
"psFormat": "table {{ .ID }}\t{{.Names}}\t{{.Status}}"
}
@ttristan
ttristan / .bash_profile
Last active May 26, 2022 13:43
OSX bash profile showing colored paths with tilde and current git branch
#https://stackoverflow.com/a/20309062/3986530
#https://misc.flogisoft.com/bash/tip_colors_and_formatting
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1="\[\033[0;49;36m\]\w\[\033[0;49;35m\]$(parse_git_branch) \[\033[1;49;94m\]->\[\e[m\] "

Step 1

docker run -d \
  -v jenkins_home:/var/jenkins_home \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -p 8080:8080 -p 50000:50000 \
  --name jenkins \
  jenkins/jenkins:lts 

What it does:

RFC: JSON Schema definition for cross-schema validation

proposed names: "darkwing duck", "JSON trivago Schema", "JSON Super Schema”, “JSON Meta Schema”, "JSON Wrapped Schema", “JSON Relational Schema”, “JSON Linked Schema"

Problem description

We need to validate api responses of our requests to remote partner services using JSON Schema validation with Ajv. For this, we need to reference data outside of the standard JSON Schema. For example: If we have the property id: 5 in the request body, we expect the response also to contain id: 5. While this data is static for this particular request, it is also dynamic across mutliple requests. The question now is, how could this be encoded inside of a JSON Schema file?

In detail: We define the API specification and standard on how partner REST services should be exposed. We will then use their service to request their data to provide it on our platform. For this, we design the respective JSON Schema files to use them

exports.reducePromises = (fns = []) =>
fns.reduce(
(promise, fn) =>
promise.then(result => {
return fn(result)
.then(Array.prototype.concat.bind(result))
.catch(Array.prototype.concat.bind(result));
}),
Promise.resolve([])
);
import React from "react";
import ReactDOM from "react-dom";
import App from "./components/App.js";
// redux
import { Provider } from "react-redux";
import { createStore, applyMiddleware } from "redux";
import thunk from "redux-thunk";
import rootReducer from "./reducers/root.reducer.js";
import { push } from "react-router-redux";
import qs from "query-string";
export const updateRouter = ({ inputId, inputValue }) => {
return function(dispatch, getState) {
const currentSearch = qs.parse(getState().router.location.search);
const searchParams = { ...currentSearch, [inputId]: inputValue };
if (!inputValue || inputValue.length === 0 || inputValue === "false") delete searchParams[inputId];
const search = qs.stringify(searchParams);
const pathname = getState().router.location.pathname;
exports.fetchGet = ({ endpoint }) => {
return new Promise((resolve, reject) => {
console.log("Requesting:", endpoint);
require("node-fetch")(endpoint)
.then(response => {
if (response.status === 200) return response.json();
else
return reject({
error: {
const express = require("express");
const bodyParser = require("body-parser");
const path = require("path");
const cors = require("cors");
// Initialize http server
const app = express();
// setup
app.use(express.static(path.resolve(__dirname, "../build")));
const express = require("express");
const bodyParser = require("body-parser");
const path = require("path");
const cors = require("cors");
// Initialize http server
const app = express();
// setup
app.use(express.static(path.resolve(__dirname, "../build")));