Skip to content

Instantly share code, notes, and snippets.

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.2.2
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
# Rails app lives here
WORKDIR /rails
# Set production environment
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
@zsyed91
zsyed91 / application.js
Last active June 25, 2020 05:18
Rails 6 Webpack/Vue configurations
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
require("jquery") // Optional, pulling this in for Bootstrap 4
@zsyed91
zsyed91 / credentials.yml
Last active September 28, 2022 19:43
Using Rails encrypted credentials with database.yml
# Used as the base secret for all MessageVerifiers in Rails, including the one protecting cookies.
secret_key_base: "key generated from <rails secret>"
production:
database_username: username
database_password: password
@zsyed91
zsyed91 / 01_install_yarn.sh
Created June 21, 2020 23:40
Beanstalk install Yarn and Node
#!/bin/bash
# File: .platform/hooks/prebuild/01_install_yarn.sh
# https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html
# With Amazon Linux 2, installation scripts on the EC2 hosts are run through
# platform hooks. This script will execute within the prebuild step which occurs
# in the staging path.
# Make sure that this file has executable permissions (chmod +x)
echo "Installing NodeJS and Yarn"
@zsyed91
zsyed91 / driver.rb
Created March 18, 2016 19:38
Quick description on how to layout our repo with the PiPiper driver
# /pi_piper/sysfs/driver.rb
module PiPiper
module Sysfs
class Driver < PiPiper::Driver
def initialize
# do stuff
end
end
@zsyed91
zsyed91 / gist:8665f5b32073efa2b375
Created February 17, 2015 03:31
Rust webserver
use std::io::prelude::*;
use std::net::{TcpListener, TcpStream};
fn main() {
let listener = TcpListener::bind("127.0.0.1:80").unwrap();
for stream in listener.incoming() {
match stream {
Ok(stream) => {