Skip to content

Instantly share code, notes, and snippets.

View 123ish's full-sized avatar

123ish LLC 123ish

View GitHub Profile
123ish / add_virtual_column_index_to_ahoy_events.rb
Created November 25, 2020 02:20 — forked from imrubyist/add_virtual_column_index_to_ahoy_events.rb
Virtual Column Index for ahoy_events table
class AddVirtualColumnIndexToAhoyEvents < ActiveRecord::Migration[6.0]
def up
ActiveRecord::Base.connection.execute (
'ALTER TABLE ahoy_events ADD properties_id INT AS (JSON_UNQUOTE(properties->"$.id")) STORED;'
ActiveRecord::Base.connection.execute (
'ALTER TABLE ahoy_events ADD INDEX (properties_id);'
def down
123ish / 11_set_preload.config
Created September 26, 2020 16:33
mode: "000644"
owner: root
group: root
content: |
123ish / 03_install.config
Created September 26, 2020 16:29
## for Aamazon Linux 2
command: yum install -y libwebp-devel libjpeg-turbo-devel ImageMagick-devel
command: |
yum install -y
if [ $? -ne 1 ]; then # Exit on any any error except 'nothing to do'
exit 0
123ish / 00_rate_limit.conf
Created September 26, 2020 16:22
# Example of nginx configulation file for AL2 Amazon Elastic Beanstalk
# your vpc subnet where ELB resides in
# Then you have the configuration like this. Please note real_ip_header and real_ip_recursive have
# to be placed in the bottom of the IP list otherwise the module will not work properly(I’ve spent so much time on this).
real_ip_header X-Forwarded-For;
123ish /
Created September 26, 2020 16:10
cd /var/app/current/
sudo /opt/elasticbeanstalk/.rbenv/shims/bundle exec whenever --update-crontab
123ish /
Created September 26, 2020 16:05
# default bundler of Amazon Linux 3.1.1 is 2.1.4, so no need to update
sudo /opt/elasticbeanstalk/.rbenv/shims/gem install bundler -v 2.1.4
123ish /
Created September 26, 2020 15:58
# need to install node first to be able to install yarn
sudo curl --silent --location | sudo bash -
sudo yum -y install nodejs
# install yarn
sudo wget -O /etc/yum.repos.d/yarn.repo
sudo yum -y install yarn
123ish / puma.rb
Last active September 26, 2020 20:52
# 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.
# Specifies the `environment` that Puma will run in.
rails_env = ENV['RACK_ENV'] || "development"
123ish / Procfile
Created September 26, 2020 15:34
AL2 Elastic Beanstalk Procfile
web: bundle exec puma -C /var/app/current/config/puma.rb
123ish / application.html.erb
Created August 15, 2020 18:03 — forked from imrubyist/application.html.erb
Step-by-Step guide on how to move from Sprockets to Webpacker - application.html.erb
<%# app/views/layouts/application.html.erb %>
<!DOCTYPE html>
<!-- add this new application.js -->
<%= javascript_pack_tag 'application' %>
<%= yield %>