This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2008-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "GiveSESPermissionToWriteEmail", | |
| "Effect": "Allow", | |
| "Principal": { | |
| "Service": [ | |
| "ses.amazonaws.com" | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #app/workers/analytics_worker.rb | |
| ## | |
| # A Sidekiq worker that handles sending order data to Analytics | |
| # Measurement Protocol | |
| class AnalyticsWorker | |
| include Sidekiq::Worker | |
| sidekiq_options retry: 2 | |
| def perform(id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def create | |
| @order = Order.new(order_params) | |
| @order.ga_id = session[:ga_id] | |
| if @order.save | |
| redirect_to orders_edit_path, notice: 'Order was successfully created.' | |
| else | |
| render 'static/home' | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
| })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
| ga('create', 'UA-54124351-6', 'auto'); | |
| ga(function(tracker) { | |
| clientId = tracker.get('clientId'); | |
| $.post({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController < ActionController::Base | |
| ## | |
| # Set the Google Analytics CID as passed via query params | |
| # and then saved onto an order if they convert | |
| def set_ga_id | |
| session[:ga_id] ||= params[:ga_id] | |
| render nothing: true | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| sudo service nginx stop | |
| sudo /home/ubuntu/letsencrypt/letsencrypt-auto renew -nvv --standalone | |
| sudo service nginx start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ssl_certificate /etc/letsencrypt/live/static-staging.example.com/fullchain.pem; | |
| ssl_certificate_key /etc/letsencrypt/live/static-staging.example.com/privkey.pem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd ~ | |
| git clone https://github.com/letsencrypt/letsencrypt | |
| cd letsencrypt | |
| sudo service nginx stop | |
| ./letsencrypt-auto certonly --standalone -d static-staging.example.com | |
| sudo service nginx start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <a target='_sef' href='/some/path?{{ransackParams(q)}}'></a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class OrdersController < ApplicationController | |
| def index | |
| ... | |
| respond_to do |format| | |
| format.json { render :index } | |
| format.csv { send_data build_csv, filename: "Orders-#{Date.today}.csv" } | |
| end | |
| end |