Skip to content

Instantly share code, notes, and snippets.

@grayside
grayside / Dockerfile
Created December 5, 2019 01:02
Hello Translate
FROM node:10-slim
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install --only=production
COPY . ./
CMD [ "npm", "start" ]
@grayside
grayside / index.js
Created September 27, 2019 18:22
Hello Translate!
const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1;
const translationClient = new TranslationServiceClient();
exports.helloTranslate = async (req, res) => {
try {
const request = {
parent: translationClient.locationPath(process.env.TRANSLATE_GCP_PROJECT, process.env.TRANSLATE_LOCATION),
contents: ['Hello World!'],
mimeType: 'text/plain',
sourceLanguageCode: 'en-US',
@grayside
grayside / create-task.sh
Last active September 16, 2019 21:21
Create a scheduled, named task.
gcloud beta tasks create-http-task sitemap-rebuild --queue my-queue \
--url "https://cms.example123-uc.a.run.app/sitemap-rebuild" \
--schedule-time 2019-09-17T05:30:00Z
@grayside
grayside / create-task.sh
Last active September 16, 2019 20:36
Create an HTTP Target Cloud Task via gcloud
gcloud beta tasks create-http-task --queue my-queue \
--url "https://search.example123-uc.a.run.app?object=piano&color=red" \
--header "Request-User-Id: user123"
@grayside
grayside / SVR202: Migrating a Monolith to (Serverless) Microservices.md
Last active April 11, 2019 04:24
Into the Woods Talks: More Information Handouts
@grayside
grayside / January 18th, 2018.md
Last active January 18, 2018 22:34
Outrigger Updates, January 18th 2018

Outrigger Release Notes

Yesterday saw a couple small releases to some of the Outrigger docker images.

Outrigger Dashboard

The Outrigger Dashboard image is automatically spun up by rig start and rig dashboard, which automatically checks for updates. THe Dashboard image has been updated to Bootstrap 4, and now has a shiny navbar to connect your use of Outrigger with the various online resources related to it. Check out what it will look like in the Navbar Pull Request.

@grayside
grayside / Dockerfile
Created December 20, 2017 17:49
Static website in a Docker container, built with Nodejs tools
# This Dockerfile uses multi-stage builds: https://docs.docker.com/engine/userguide/eng-image/multistage-build/
# The builder image has all the dependencies necessary to assemble the website.
FROM node:8-alpine as builder
# The COPY operation looks to see if any of the source files changed since the last time the container was built.
# If not changed, it uses the cached copy of this operation. If it is changed, it performs the copy and all
# following steps for the builder, and for the COPY operation in the nginx image below.
COPY ./package.json ./package-lock.json /code/frontend/
WORKDIR /code/frontend
RUN npm install
@grayside
grayside / article.schema.json
Created September 21, 2017 19:14
Example Article Schema Output from Schemata module. Check out ._embedded.field_anyof_example
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://www.api-dx.vm/schemata/node/article?_format=schema_json&_describes=hal_json",
"type": "object",
"title": "node:article Schema",
"description": "Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.",
"properties": {
"nid": {
"type": "array",
"title": "ID",
@grayside
grayside / A Series of Useful Outrigger Docker Snippets
Last active February 15, 2018 21:12
Outrigger/Docker Shenanigans Outside a Project Configuration
The individual files in this gist each have a unique trick to offer. They may be moved to official documentation or individual gists at a future date.
This file is mostly added because gists insist on titling the page with the alphabetically first file name, instead of the gist title.
@grayside
grayside / install.js
Created July 13, 2017 18:02
Customize the `grunt install` command's drush site-install line for your project
/**
* Customized site install routine.
*
* Used as part of grunt install.
*
* Place this file wherever custom grunt-drupal-tasks plugins are loaded, such as bin/grunt for an Outrigger Drupal project.
*/
module.exports = function(grunt) {
// Modify the drush site-install component of the routine.