Skip to content

Instantly share code, notes, and snippets.

View rosskevin's full-sized avatar

Kevin Ross rosskevin

View GitHub Profile
@rosskevin
rosskevin / Dockerfile
Created October 1, 2018 19:58
nginx envsubst escape $
FROM nginx:alpine
# https://thepracticalsysadmin.com/templated-nginx-configuration-with-bash-and-docker/
ENV LISTEN_PORT=80 \
NGINX_ENV=production \
SERVER_NAME=_ \
RESOLVER=8.8.8.8 \
UPSTREAM_API=api:3000 \
UPSTREAM_API_PROTO=http \
WORKDIR=/www \
@rosskevin
rosskevin / Col.js
Last active December 11, 2022 18:15
material-ui `next` responsive layout/grid using JSS (originally based on flexboxgrid.com)
// @flow
import React, {Component, Element, PropTypes} from 'react'
import classNames from 'classnames'
import pure from 'recompose/pure'
import merge from 'lodash/merge'
import {createStyleSheet} from 'jss-theme-reactor'
import Logger from '../../util/Logger'
import {capitalizeFirstLetter} from '../../util/strings'
type DefaultProps = {
@rosskevin
rosskevin / browser-rewrite.conf
Last active July 28, 2022 06:20
nginx map for outdated or unsupported browser redirect based on browserslist output
# include in the server section of the conf.
# ---------------------------------------------------------------
# If we perform a rewrite on every immediately, images won't be
# displayed, so we have to avoid the rewrite for specific files
# in support of displaying the outdated page.
#
set $browser_unsupported_rewrite do_not_perform;
if ($outdated){
@rosskevin
rosskevin / hoc-template.tsx
Last active August 23, 2020 19:44
Typescript higher order component (hoc) template
/* variation on https://medium.com/@DanHomola/react-higher-order-components-in-typescript-made-simple-6f9b55691af1 */
import * as React from 'react'
import { wrapDisplayName } from 'recompose'
// Props you want the resulting component to take (besides the props of the wrapped component)
interface ExternalProps {}
// Props the HOC adds to the wrapped component
export interface InjectedProps {}
@rosskevin
rosskevin / cloudSettings
Last active November 21, 2019 21:14
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-11-21T21:14:36.267Z","extensionVersion":"v3.4.3"}
@rosskevin
rosskevin / waitForJob.ts
Created July 9, 2019 19:00 — forked from lukehoban/waitForJob.ts
Pulumi program which waits on Jobs during a Kubernetes deployment
import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";
import * as k8sOutput from "@pulumi/kubernetes/types/output";
import * as k8sapi from 'kubernetes-client';
const job = new k8s.batch.v1.Job("job", {
spec: {
template: {
spec: {
containers: [{
@rosskevin
rosskevin / features-support-javascript.rb
Last active May 9, 2019 08:20
Continuous Integration, parallel_tests, cucumber, headless, capybara-webkit, chrome. For mac and linux.Conditionally @show chrome browser (:selenium) in development if @show tag is used, otherwise run headless and *always* run headless in a CI environment regardless of the tag's presence. Check javascript errors automatically when using webkit.
# verified against log_in.feature for blake
# https://github.com/jnicklas/capybara/issues/1443
# turn on webkit driver debug
$use_webkit = true
$use_chrome_instead_of_firefox = false
$webkit_debug = false
$wait_time = 5
def webkit_driver
if $webkit_debug
@rosskevin
rosskevin / intercom.ts
Created April 9, 2019 21:52
jss material-ui hide intercom chat
// tslint:disable:object-literal-sort-keys
import { create, StyleSheet } from 'jss'
import { jssPreset } from '@material-ui/core'
const jss = create(jssPreset())
const log = Logger.get('Intercom')
let invisibleSheet: undefined | StyleSheet<string>
@rosskevin
rosskevin / ResponsiveDialog.tsx
Last active December 3, 2018 16:37
Responsive material-ui dialog
import { ExtendMui } from '@alienfast/ui/styles'
import { default as MuiDialog, DialogProps as MuiDialogProps } from '@material-ui/core/Dialog'
import { createStyles, Theme, withStyles, WithStyles } from '@material-ui/core/styles'
import { keys } from '@material-ui/core/styles/createBreakpoints'
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints'
import withMobileDialog from '@material-ui/core/withMobileDialog'
import { isWidthUp } from '@material-ui/core/withWidth'
import * as React from 'react'
const MobileResponsiveDialog = withMobileDialog<MuiDialogProps>({ breakpoint: 'xs' })(MuiDialog)
@rosskevin
rosskevin / gen
Created November 13, 2018 22:17
ksonnet setup
#!/usr/bin/env bash
set -e
MANIFESTS=${BASH_SOURCE%/*}/./environments/$1/manifests
rm -rf ${MANIFESTS} && mkdir ${MANIFESTS}
FILE=${MANIFESTS}/cert-manager.yml
./show "$@" --module cert-manager > ${FILE}
FILE=${MANIFESTS}/certificates.yml