Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dominicsayers's full-sized avatar
☣️
I'm back

Dominic Sayers dominicsayers

☣️
I'm back
View GitHub Profile
@dominicsayers
dominicsayers / GET interest_category.md
Last active April 20, 2016 15:38
Mailchimp API v3 - problem creating an interest in an interest_category using API v3

Firstly, we'll GET the interest_category to demonstrate the api_key is OK:

  • Method: GET
  • URL: https://us11.api.mailchimp.com/3.0/lists/e73f5910ca/interest-categories/bc914b7356/interests
  • Request headers: Authorization: apikey df8658fb18403e29ef4a8437a8eb3705-us11

Response:

{
  "interests": [
@dominicsayers
dominicsayers / sublime-text-settings.js
Last active August 17, 2017 10:31
Sublime Text 3 personal settings
{
"folder_exclude_patterns": [".git", "coverage", "cache", "uploads"],
"binary_file_patterns":
[
"*/tmp/*",
"*/attachment/*",
"log/",
"coverage/",
"*/public/uploads/*",
"*/public/assets/*",
@dominicsayers
dominicsayers / preferences.js
Last active August 29, 2015 14:22
Sublime Text preferences
{
// The number of spaces a tab is considered equal to
"tab_size": 2,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": true,
// Set to true to removing trailing white space on save
"trim_trailing_white_space_on_save": true,
@dominicsayers
dominicsayers / cloudmailin-mailapp.json
Created June 6, 2015 21:34
JSON sent by Cloudmailin (sent from OS X Mail app - Bcc header not set)
{
"headers": {
"Return-Path": "dominic@xenapto.com",
"Received": [
"by wibut5 with SMTP id ut5so50815534wib.1 for <smartangel@xenapto.me>; Sat, 06 Jun 2015 14:31:21 -0700",
"from [192.168.1.75] (host86-150-30-216.range86-150.btcentralplus.com. [86.150.30.216]) by mx.google.com with ESMTPSA id q4sm16773563wju.14.2015.06.06.14.31.20 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 06 Jun 2015 14:31:20 -0700"
],
"Date": "Sat, 06 Jun 2015 22:31:18 +0100",
"From": "Dominic Sayers <dominic@xenapto.com>",
"To": "To1 <to1@xenapto.com>, To2 <to2@xenapto.com>",
@dominicsayers
dominicsayers / cloudmailin-gmail.json
Last active August 29, 2015 14:22
JSON sent by CloudMailin (sent from Gmail - Bcc header is set)
{
"headers": {
"Received": [
"by lbio15 with SMTP id o15so1647431lbi.1 for <smartangel@xenapto.me>; Sat, 06 Jun 2015 08:19:30 -0700",
"by 10.112.72.99 with HTTP; Sat, 06 Jun 2015 08:19:30 -0700"
],
"Date": "Sat, 06 Jun 2015 16:19:30 +0100",
"From": "Dominic Sayers <dominic.sayers@gmail.com>",
"To": "To1 <to1@xenapto.com>, To2 <to2@xenapto.com>",
"Cc": "Cc1 <cc1@xenapto.com>, Cc2 <cc2@xenapto.com>",
irb -rubygems -I lib -r foreplay.rb
@dominicsayers
dominicsayers / production_credentials.md
Last active August 29, 2015 14:19
Production credentials

Removing all secrets from the repo

  1. Deployment to production is from CircleCI.
  2. The deployment command is configured in circle.yml, which is checked into the repo and cannot contain any secrets.
  3. CircleCI can have env vars configured
  4. circle.yml is passed through ERB [check], so we can add secret parameters to the deployment command using erb, e.g. foreplay deploy production -u <%= ENV['DEPLOYMENT_USERNAME'] %> -p <%= ENV['DEPLOYMENT_PASSWORD'] %>
  5. The secret credentials can be used to connect to a remote service and download the remainder of the production secrets.
  6. The secrets can be included in the .env file created by Foreplay and become part of the production runtime environment.
@dominicsayers
dominicsayers / registerable.rb
Last active August 29, 2015 14:17
Registerable concern
module Registerable
extend ActiveSupport::Concern
module ClassMethods
# Register a new record or return an existing one. This version will work
# in a highly-concurrent environment where multiple process are updating
# this model, but it's slower than `fast_register`.
def safe_register(attributes = {})
begin
create! unique_values(attributes)
@dominicsayers
dominicsayers / +++ zsh and bash configuration +++
Last active June 7, 2019 13:31
Dominic's bash & zsh shell config
Dominic's configuration files for `zsh` and `bash`
@dominicsayers
dominicsayers / rails-4.2-upgrade.md
Created March 12, 2015 13:07
Upgrading from Rails 3.2 to Rails 4.2

I Googled an upgrade guide and read two or three before starting. Useful information.

This page just lists the things I didn't find in the upgrade guides.

Asset pipeline

  • Static files Rails 4.2 doesn't serve static files by default, and config.serve_static_assets is deprecated. Instead you need to set the environment variable RAILS_SERVE_STATIC_FILES to true in the production environment.

Rspec

I upgraded to Rspec 3.2. Things to note: