Skip to content

Instantly share code, notes, and snippets.

wmakley / aws_ses_delivery_method.rb
Last active July 26, 2022 09:12
Use AWS SESv2 SDK as an ActionMailer delivery method (API call instead of SMTP)
View aws_ses_delivery_method.rb
# Why?
# * May use same IAM role or account in use for other app features.
# * Avoid sharing same SMTP credentials across multiple apps.
# Alternatives:
# * (may be overkill)
# Gemfile:
# gem 'aws-sdk-sesv2'
wmakley / 12-days.rb
Last active December 24, 2021 20:54
Count the number of times each gift is given
View 12-days.rb
#!/usr/bin/env ruby
verses = {
1 => "Patridges in a pear tree",
2 => "Turtle doves",
3 => "French hens",
4 => "Calling birds",
5 => "Golden rings",
6 => "Geese a layin'",
7 => "Swans a swimmin'",
wmakley /
Created November 7, 2020 17:19
WSL SSH Agent Workaround
# Start ssh-agent if not started (WSL workaround)
# See:
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
agent_start () {
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null ; }
wmakley / business-catalyst-dynamic-credit-card-years.liquid
Created November 8, 2017 17:29
Dynamically generated credit card year dropdown for Adobe Business Catalyst
View business-catalyst-dynamic-credit-card-years.liquid
{% assign currentYear = | date: "yyyy" %}
{% for i in (0..10) -%}
{% capture yearIncrement -%}{{currentYear | plus: i}}{% endcapture -%}
<option value="{{yearIncrement}}">{{yearIncrement}}</option>
{% endfor -%}
wmakley / elm_handlers.js
Last active January 2, 2020 17:49
jQuery-based utilities for things that are hard to do in Elm. Modify as desired. It is used in a project that already depends on jQuery, but it only really needs jQuery for attaching event handlers to the app container, and normalizing key press events.
View elm_handlers.js
port module JSCmd exposing (..)
port focus : String -> Cmd msg
wmakley /
Last active November 15, 2017 18:26
Lessons Learned From a Year of Elm

Lessons Learned From a Year of Elm

These are some of the lessons I wish I had learned when I first picked up Elm, before I wrote a bunch of apps that are now more difficult to maintain than they need to be.

1. Not Everything Needs to be a Package.

Breaking an Elm program up into multiple files just to reduce scrolling does not tend to work out optimally. Evan gave a really cool talk on this called "The life of a file". Files should split organically around data structures, not just to stay short. The reasons we want to keep JavaScript files as short as possible do not apply to Elm.

For example, I've created apps with a file structure like this:

wmakley / Makefile
Last active December 15, 2016 19:33
Example Makefile for Elm with multiple targets
View Makefile
# Assumes 'elm' is in your PATH, and there is a directory called 'src' containing
# your Elm source code in the same directory as this file.
ELM = elm
OUTPUT = ../assets/javascripts/elm # For Rails asset pipeline, but could be anything
SRCS = MyApp.elm MyOtherApp.elm
TARGETS = $(SRCS:.elm=.js)
ELM_STUFF = elm-stuff/exact-dependencies.json
all: $(TARGETS)
wmakley /
Last active October 7, 2021 09:41 — forked from silviorelli/gist:ad8e1d80bdc0245eb7e7
Install Ruby 1.8.7 on Mac OSX 10.12 Sierra with rbenv
# The main issues with Ruby 1.8.7 are that it won't build with Clang,
# and the Net::HTTPS module won't work with modern versions of OpenSSL.
# This assumes you have already set up homebrew, and run: xcode-select --install
brew install homebrew/dupes/apple-gcc42
brew install libyaml libffi
brew install
export CC=/usr/local/bin/gcc-4.2
View ssl-warning.html
// simple jQuery version. change variables to customize.
window.parseTLSinfo = function(data) {
var alert_classes = 'ssl-notice alert';
var prepend_to = 'body';
var tls_version = parseFloat(data.tls_version.split(/\s+/)[1]);
if (isNaN(tls_version)) { throw "couldn't parse TLS version from input: " + data.tls_version; }
if (tls_version < 1.1) {
wmakley / refinery-frontend.css
Last active August 29, 2015 14:16
Refinery CMS front-end CSS
View refinery-frontend.css
/* Make wymeditor-inserted images appear correctly in front-end. Tweak margins as needed. */
.image-align-left {
float: left;
margin: 10px 20px 0 10px;
.image-align-right {
float: right;
margin: 10px 0 10px 20px;