Skip to content

Instantly share code, notes, and snippets.

View mdoyle13's full-sized avatar

Mike Doyle mdoyle13

View GitHub Profile
@skatkov
skatkov / test.rb
Last active January 3, 2024 18:20
speed up testsuit by using unlogged tables in PG
# config/environments/test.rb
ActiveSupport.on_load(:active_record_postgresqladapter) do
# For this optimization to work, you need to recreate your test database
self.create_unlogged_tables = true
end
@mdoyle13
mdoyle13 / Dockerfile
Created May 4, 2020 18:48
Rails 6, ruby 2.7 Docker for Development
FROM ruby:2.7
RUN apt-get update && apt-get install -y \
curl \
build-essential \
libpq-dev &&\
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y nodejs yarn vim
@sfrancavilla
sfrancavilla / nginx.conf
Created May 13, 2019 07:59
Deploy Ruby on Rails apps (+ NGINX) to ECS with Docker - Medium
# 1.Upstream used to define groups of servers, in this case the rails app, that can be referenced by the proxy_pass
upstream rails_app {
server app:3000;
}
# 2.Server part
server {
# 2.1.Listen to incoming connection on port 80
listen 80;
listen [::]:80;
@veelenga
veelenga / imagemagick.bash
Last active May 17, 2022 23:43 — forked from bensie/imagemagick.bash
ImageMagick Static Binaries with HEIC support for AWS Lambda
#!/usr/bin/env bash
# Must be run on an Amazon Linux AMI that matches AWS Lambda's runtime which can be found at:
# https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html
#
# As of Jan 10, 2019, this is:
# Amazon Linux AMI 2017.03.1.20170812 x86_64 HVM GP2 (ami-4fffc834)
#
# Lambda includes ImageMagick 6.7.8-9 preinstalled, so you need to prepend PATH
# with the folder containing these binaries in your Lambda function to ensure
@mdoyle13
mdoyle13 / 01_yarn.config
Created April 25, 2017 00:51
Deploy webpacker on aws
files:
# If this file is edited, it must be removed from EC2 instance prior to deploy.
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_yarn_install.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash
set -xe
@sealocal
sealocal / yarn.config
Last active May 14, 2021 12:16
Install Yarn and NodeJS on AWS Elastic Beanstalk EC2 Instance with Amazon Linux Ruby Platform, prior to precompiling assets for a Rails app
files:
# If this file is edited, it must be removed from EC2 instance prior to deploy.
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_yarn_install.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash
set -xe
@hendricius
hendricius / 01_add_cors.config.yaml
Created June 27, 2016 17:24 — forked from vsviridov/01_add_cors.config.yaml
Add CORS to Nginx on AWS Elastic Beanstalk (Rails)
container_commands:
01_fix_static_cors:
command: "/tmp/fix_static_cors.sh"
files:
"/tmp/fix_static_cors.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
@andrius
andrius / Procfile
Last active July 22, 2022 22:00
How to dockerize #rails app with #puma. Edit config/application.rb and config/puma.rb #docker #ruby
api: bundle exec puma -C config/puma.rb
@gaearon
gaearon / connect.js
Last active June 24, 2024 09:43
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@bensie
bensie / imagemagick.bash
Last active June 24, 2024 12:21
ImageMagick Static Binaries for AWS Lambda
#!/usr/bin/env bash
# Must be run on an Amazon Linux AMI that matches AWS Lambda's runtime which can be found at:
# https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html
#
# As of May 21, 2019, this is:
# Amazon Linux AMI 2018.03.0 (ami-0756fbca465a59a30)
#
# You need to prepend PATH with the folder containing these binaries in your Lambda function
# to ensure these newer binaries are used.