Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Chris Oliver excid3

🎯
Focusing
Block or report user

Report or block excid3

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
@excid3
excid3 / _attachment.html.erb
Last active May 7, 2019 — forked from aymorgan/_attachment.html.erb
JQuery File Upload, Amazon S3 and Shrine - rendering with a partial
View _attachment.html.erb
<!-- app/views/attachments/_attachment.html.erb -->
<div class="attachment-image col-xs-6 col-sm-4 col-md-3" id="attachment_<%= @report.slug %><%= attachment.id %>elv1">
<div class="row">
<div class="attached-image-wrapper col-xs-12">
<a class="attached-image" data-lightbox="report-attachment" style="background-image:url('<%= attachment.image_url(:preview) %>');" href="<%= attachment.image_url(:original) %>"></a>
</div>
</div>
<div class="attachment-options-wrapper">
View database.yml
<%
require 'cgi'
require 'uri'
begin
uri = URI.parse(ENV["DATABASE_URL"])
rescue URI::InvalidURIError
raise "Invalid DATABASE_URL"
end
raise "No RACK_ENV or RAILS_ENV found" unless ENV["RAILS_ENV"] || ENV["RACK_ENV"]
def attribute(name, value, force_string = false)
View log.sh
# Logfile created on 2019-02-06 14:39:16 -0800 by logger.rb/66358
INFO ---------------------------------------------------------------------------
INFO START 2019-02-06 14:39:16 -0800 cap production deploy
INFO ---------------------------------------------------------------------------
DEBUG [a31dcb3c] Running [ -d $HOME/.rbenv/versions/2.5.3 ] as deploy@104.248.186.100
DEBUG [a31dcb3c] Command: [ -d $HOME/.rbenv/versions/2.5.3 ]
DEBUG [7cf4009d] Finished in 9.738 seconds with exit status 0 (successful).
INFO [1bc30033] Running /usr/bin/env mkdir -p /tmp as deploy@104.248.186.100
DEBUG [1bc30033] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.3" ; /usr/bin/env mkdir -p /tmp )
INFO [815d8d82] Finished in 0.099 seconds with exit status 0 (successful).
View php-fpm.conf
; /etc/php/7.3/fpm/php-fpm.conf
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;
; All relative paths in this configuration file are relative to PHP's install
; prefix (/usr). This prefix can be dynamically changed by using the
; '-p' argument from the command line.
@excid3
excid3 / dynamic-nginx-module-ubuntu-18.04.sh
Created Jun 20, 2018
How to compile a dynamic nginx module for Ubuntu 18.04
View dynamic-nginx-module-ubuntu-18.04.sh
# Install dependencies that nginx was originally compiled with
sudo apt install libperl-dev libgeoip-dev libgd-dev
# Get the nginx source
wget https://nginx.org/download/nginx-1.14.0.tar.gz
tar zxf nginx-1.14.0.tar.gz
# Get the module source
wget https://github.com/fdintino/nginx-upload-module/archive/master.zip
unzip master.zip
View gist:2f7b70e73911effcca81c876e222a261
server {
listen 80;
listen [::]:80;
server_name _;
passenger_enabled on;
rails_env production;
root /home/deploy/build.gorails.com/current/public;
@excid3
excid3 / middleware.rb
Created Mar 5, 2018 — forked from romaimperator/middleware.rb
Middleware to support prefixed value in the url
View middleware.rb
class MyMiddleware
def initialize(app)
@app = app
@message = message
end
def call(env)
dup._call(env)
end
@excid3
excid3 / require_payment_upfront.patch
Created Oct 19, 2017
Stripe Payments Course: Requiring payments upfront
View require_payment_upfront.patch
From e0e025f141ad50ca83c729f26a2035cf2f214262 Mon Sep 17 00:00:00 2001
From: Chris Oliver <excid3@gmail.com>
Date: Wed, 1 Feb 2017 17:19:12 -0600
Subject: [PATCH] Add stripe payments as required for registration
---
Gemfile | 1 +
Gemfile.lock | 5 +-
app/assets/javascripts/payments.js | 39 ++++++++++++++
app/controllers/application_controller.rb | 7 ++-
View puma.rb
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
View _form.html.erb
<%= content_tag :div, id: "team-form", data: { team: team.to_json(except: [:created_at, :updated_at]), players_attributes: team.players.to_json(except: [:team_id, :created_at, :updated_at]) } do %>
<label for="team_name">Team Name</label>
<input id="team_name" v-model="team.name" />
<h4>Players</h4>
<div v-for="(player, index) in team.players_attributes">
<div v-if="player._destroy == '1'">
{{ player.name }} will be removed
<button v-on:click.prevent="undoDelete(index)">Undo</button>
You can’t perform that action at this time.