Skip to content

Instantly share code, notes, and snippets.

Stu Smith stu-smith

Block or report user

Report or block stu-smith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stu-smith
stu-smith / lambda-at-edge.yaml
Last active Jul 5, 2019
Shows how to use CloudFormation to attach a Lambda@Edge function to a CloudFront distribution to add HSTS and CSP custom headers. NOTE: The stack must be updated twice: once with the condition set to false, and once with it set to true.
View lambda-at-edge.yaml
AWSTemplateFormatVersion: 2010-09-09
Parameters:
RootDomainName:
Type: String
IncludeLambdaEdge:
Type: String
AllowedValues: ['true', 'false']
Conditions:
IncludeLambdaEdge:
!Equals ['true', !Ref IncludeLambdaEdge]
@stu-smith
stu-smith / static-site.yaml
Created Dec 28, 2017
AWS CloudFormation for HTTPS static website hosting using S3, CloudFront, and ACM
View static-site.yaml
AWSTemplateFormatVersion: 2010-09-09
Parameters:
RootDomainName:
Type: String
Mappings:
RegionMap:
us-east-1:
S3HostedZoneID: Z3AQBSTGFYJSTF
S3WebsiteEndpoint: s3-website-us-east-1.amazonaws.com
us-west-1:
View i3-config
# Lives in: ~/.i3/config
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
View atom-predawn-styles.less
// ===================================================
// Predawn enhancements for oldies with bad eyesight.
// ===================================================
// Start with: predawn-ui, predawn-syntax.
// Add highlight-line.
// Suggested font: Source Code Pro 14 or Consolas 14
// Make the tree and tab fonts a little larger.
@stu-smith
stu-smith / elementary-setup.bash
Last active Aug 29, 2015
Setup for Elementary OS. Probably won't be suitable for your setup...
View elementary-setup.bash
#!/bin/bash
set -exu
# SublimeHaskell hints:
# ~/.config/sublime-text-2/Packages/SublimeHaskell
# cabal install --reinstall --enable-shared primitive
# http://stackoverflow.com/questions/23927744/where-is-libhsprimitive-0-5-3-0-so
if [ "$(id -u)" != "0" ]; then
@stu-smith
stu-smith / font-metrics.js
Last active Mar 7, 2016
Measuring text in JavaScript, server-side, using Adobe font metrics
View font-metrics.js
// FILE: font-metrics.js
(function () {
'use strict';
module.exports['Courier'] = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, -1, 600, 600, 600, 600, -1, 600, 600, 600, 600, 600, 600, 600, 600, -1, 600, -1, 600, 600, 600, 600, 600, 600, 600,
@stu-smith
stu-smith / form-utility.js
Last active Oct 1, 2015
Simple utility methods to copy Backbone models to and from forms
View form-utility.js
define([
'jQuery',
'Underscore'
], function ($, _) {
'use strict';
return {
clearForm: function (f) {
You can’t perform that action at this time.