Skip to content

Instantly share code, notes, and snippets.

View knoxjeffrey's full-sized avatar

Jeff Knox knoxjeffrey

View GitHub Profile
require 'rails_helper'
describe Members::Charters::JoinedUpForm, type: :model do
context 'validations' do
let(:charter) { create(:charter) }
let(:charter_two) do
create(:charter, progression_to_service_evidence: true)
end
let(:charter_three) do
create(:charter, past_current_partnerships_evidence: true)
# frozen_string_literal: true
# Members module
module Members
# Charters module
module Charters
# JoinedUpForm class
class JoinedUpForm < CharterFormBase
ATTRS = %i[
progression_to_service progression_to_service_evidence
@knoxjeffrey
knoxjeffrey / media_staging_to_production.rake
Created October 23, 2018 23:20
Pull media from specified staging to production
# rake media:staging_to_production
# eg. rake media:staging_to_production
namespace :media do
desc 'Pull media from specified staging to production'
task :staging_to_production do
ssh_staging = Rails.application.credentials[:staging][:ssh]
ssh_staging_port = Rails.application.credentials[:staging][:ssh_port]
media_staging_remote = Rails.application.credentials[:staging][:media_remote]
media_production_remote = Rails.application.credentials[:production][:media_remote]
@knoxjeffrey
knoxjeffrey / media_pull.rake
Created October 23, 2018 23:19
Pull media from specified environment to development
# rake media:pull[<environment to pull from>]
# eg. rake media:pull[staging]
namespace :media do
desc 'Pull media from specified environment to development'
task :pull, :environment do |_t, args|
environment = args[:environment].to_sym
ssh = Rails.application.credentials[environment][:ssh]
ssh_port = Rails.application.credentials[environment][:ssh_port]
media_remote = Rails.application.credentials[environment.to_sym][:media_remote]
@knoxjeffrey
knoxjeffrey / db_staging_to_production.rake
Created October 23, 2018 23:18
Pull specified db to development, move to production
# rake db:staging_to_production
# eg. rake db:staging_to_production
namespace :db do
desc 'Pull specified db to development, move to production'
task :staging_to_production do
dumpfile = "#{Rails.root}/tmp/latest.dump"
ssh = Rails.application.credentials[:staging][:ssh]
ssh_port = Rails.application.credentials[:staging][:ssh_port]
@knoxjeffrey
knoxjeffrey / db_pull.rake
Created October 23, 2018 23:09
Pull specified db to development
# rake db:pull[<environment to pull from>,<your local db username>]
# eg. rake db:pull[staging,postgres]
namespace :db do
desc 'Pull specified db to development'
task :pull, :environment, :dev_db_user do |_t, args|
environment = args[:environment].to_sym
dev_db_user = args[:dev_db_user]
dev = Rails.application.config.database_configuration['development']
dumpfile = "#{Rails.root}/tmp/latest.dump"
#!/bin/bash
#
# Go to ec2-user home directory
cd /home/ec2-user
# Update libpng first
curl -L http://sourceforge.net/projects/libpng/files/libpng15/1.5.27/libpng-1.5.27.tar.xz/download -o libpng.tar.xz
tar -Jxf libpng.tar.xz
cd libpng-1.5.27/
@knoxjeffrey
knoxjeffrey / aws-postgis.txt
Last active April 17, 2019 08:43
Script to setup a Elastic Beanstalk AMI with geospatial libraries and postGIS
#!/bin/bash
#
# Script to setup a Elastic Beanstalk AMI with geospatial libraries and postGIS
#
# sh aws_ami_prep.sh > aws_ami_prep.log 2>&1 &
# See orig here: https://gist.github.com/whyvez/8d19096712ea44ba66b0
# Go to ec2-user home directory
cd /home/ec2-user
@knoxjeffrey
knoxjeffrey / gist:084acb8b0132225e5eed
Created July 11, 2015 22:40
Archive for jekyll theme
---
layout: default
---
<section class="posts postindex wrapper">
{% for post in site.posts %}
{% capture month %}{{ post.date | date: '%m%Y' }}{% endcapture %}
{% capture nmonth %}{{ post.next.date | date: '%m%Y' }}{% endcapture %}
{% if month != nmonth %}
{% if forloop.index != 1 %}</ul>{% endif %}
class NotesController < ApplicationController
def index
load_notes
end
def show
load_note
end
def new