Docker's Remote API can be secured via TLS and client certificate verification.
First of all you need a few certificates and keys:
- CA certificate
- Server certificate
- Server key
- Client certificate
- Client key
<!doctype html> | |
<title>Site Maintenance</title> | |
<style> | |
body { text-align: center; padding: 150px; } | |
h1 { font-size: 50px; } | |
body { font: 20px Helvetica, sans-serif; color: #333; } | |
article { display: block; text-align: left; width: 650px; margin: 0 auto; } | |
a { color: #dc8100; text-decoration: none; } | |
a:hover { color: #333; text-decoration: none; } | |
</style> |
#!/usr/bin/env bash | |
# This script is meant to build and compile every protocolbuffer for each | |
# service declared in this repository (as defined by sub-directories). | |
# It compiles using docker containers based on Namely's protoc image | |
# seen here: https://github.com/namely/docker-protoc | |
set -e | |
REPOPATH=${REPOPATH-/opt/protolangs} | |
CURRENT_BRANCH=${CIRCLE_BRANCH-"branch-not-available"} |
function zipObject(keys, values) { | |
// often simple edge cases are taken care of at the top so they aren't hidden inside the middle of the function | |
if (keys === undefined && values === undefined) { | |
return {}; // for test 3 | |
} | |
// category of problem: convert [] -> {} | |
// simple strategy for conversion problems is to create a blank object at the beginning, build it up in the middle, return it at the end | |
// create blank starter obj |
image: node:6.5.0 # can be upgraded, depending on your node version used | |
pages: | |
stage: deploy | |
script: | |
- npm install | |
- npm run build | |
- rm -rf public | |
- mv build public | |
artifacts: |
import React, { Component } from "react"; | |
import "./index.css"; | |
import todosList from "./todos.json"; | |
class App extends Component { | |
state = { | |
todos: todosList | |
}; | |
handleCreateTodo = event => { |
#!/bin/bash | |
# Verify Ruby is installed (Installed by default in MacOS) | |
if [ -x !"$(command -v ruby)" ]; then | |
echo 'Ruby is not installed. See instructor.' | |
exit 1 | |
fi | |
# Install Homebrew | |
if [ ! -x "$(command -v brew)" ]; then |
When querying your database in Sequelize, you'll often want data associated with a particular model which isn't in the model's table directly. This data is usually typically associated through join tables (e.g. a 'hasMany' or 'belongsToMany' association), or a foreign key (e.g. a 'hasOne' or 'belongsTo' association).
When you query, you'll receive just the rows you've looked for. With eager loading, you'll also get any associated data. For some reason, I can never remember the proper way to do eager loading when writing my Sequelize queries. I've seen others struggle with the same thing.
Eager loading is confusing because the 'include' that is uses has unfamiliar fields is set in an array rather than just an object.
So let's go through the one query that's worth memorizing to handle your eager loading.
openapi: 3.0.1 | |
info: | |
title: Photo Sharing Service | |
version: "1.0.0" | |
servers: | |
- url: http://localhost:3000/api | |
description: localhost | |
- url: https://{domain}/api | |
description: Production Server | |
variables: |
import React, { useEffect, useState } from "react"; | |
import { useHistory, useLocation } from "react-router"; | |
const ExampleQueryParam = () => { | |
const history = useHistory(); | |
const location = useLocation(); | |
const [q, setQ] = useState(new URLSearchParams(location.search).get("q")); | |
useEffect(() => { | |
history.replace("?" + new URLSearchParams([["q", q]]).toString()); |