Skip to content

Instantly share code, notes, and snippets.

View mhazy's full-sized avatar

Mark Hayes mhazy

  • Ontario, Canada
View GitHub Profile
@mhazy
mhazy / index.js
Last active June 15, 2023 14:45
Simple node service to test chunked transfer encoding
import http from 'node:http';
// `curl -iN http://localhost:8080`
function sleep() {
return new Promise((resolve) => {
setTimeout(() => resolve(), 1000)
});
}

Keybase proof

I hereby claim:

  • I am mhazy on github.
  • I am mhazy (https://keybase.io/mhazy) on keybase.
  • I have a public key ASDfCzPeHMkLWvlRaYxrZmfFnsPA24TagH1mF0jEvP8SSgo

To claim this, I am signing this object:

#!/bin/sh
# Environment
export ALDO_ENV="test"
export NODE_ENV="test"
# Containers, etc.
CONTAINERS_TOTAL=${CIRCLE_NODE_TOTAL:-"1"}
CONTAINERS_INDEX=${CIRCLE_NODE_INDEX:-"1"}
@mhazy
mhazy / codeship-s3-sync.sh
Last active August 29, 2017 14:34
CodeShip deployment script for syncing build to S3 and setting per-file cache settings
# make sure awscli is installed
pip install awscli
# build
grunt build-staging
# Clear staging path on s3
aws s3 rm s3://[BUCKET NAME]/[DIRECTORY] --recursive
# Sync the dist folder
aws s3 sync ./dist s3://[BUCKET NAME]/[DIRECTORY] --acl public-read --cache-control "public, max-age=86400"
# Update index.html to have a 60sec cache
aws s3api copy-object --copy-source [BUCKET NAME]/[FILEPATH] --cache-control "public, max-age=60" --content-type "text/html" --bucket [BUCKET NAME] --key [FILEPATH] --metadata-directive="REPLACE"
function toolbar_test_toolbar() {
$items = [];
$items['scribe_posts'] = array(
'#type' => 'toolbar_item',
'tab' => array(
'#type' => 'link',
'#title' => t('Posts'),
'#url' => Url::fromUri('http://www.google.com'),
'#attributes' => array(