Skip to content

Instantly share code, notes, and snippets.

.ebextensions/01_postgres_packages.config # Packages needed to install the `pg` postgres gem.
config/eb_deployer.yml # It configures eb_deployer options as well as Elastic Beanstalk.
config/rds.json # The CloudFormation stack configuration with a Postgres RDS instance.
lib/tasks/eb_deployer.rake # Deployment tasks for you to customize.
application: example_app
common:
solution_stack_name: 64bit Amazon Linux 2015.03 v1.3.1 running Ruby 2.1 (Passenger Standalone)
smoke_test: |
curl_http_code = "curl -s -o /dev/null -w \"%{http_code}\" http://#{host_name}"
Timeout.timeout(600) do
until ['200', '301', '302'].include?(`#{curl_http_code}`.strip)
sleep 5
namespace :eb do
def eb_deployer_env
ENV["EB_DEPLOYER_ENV"] || "dev"
end
def eb_deployer_package
git_sha = `git log -n1 | awk '/^commit/ {print $2; exit;}' | cut -c 1-10`.strip
"tmp/pkg/example_app-#{git_sha}-#{ENV['VERSION_LABEL_SUFFIX']}.zip"
end
production:
adapter: postgresql
database: <%= ENV['DATABASE_NAME'] || 'example_app' %>
host: <%= ENV['DATABASE_HOST'] || 'localhost' %>
port: <%= ENV['DATABASE_PORT'] || 5432 %>
username: <%= ENV['DATABASE_USERNAME'] || 'my_user' %>
password: <%= ENV['DATABASE_PASSWORD'] %>
min_messages: ERROR
@marano
marano / 0_reuse_code.js
Created April 5, 2016 16:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
gem 'eb_deployer'
@marano
marano / generate_secret.rb
Created November 7, 2015 14:06
Generate random secret
all_characters = [('a'..'z'), ('A'..'Z'), (0..9)].map { |i| i.to_a }.flatten
secret = (0...100).map { all_characters[rand(all_characters.length)] }.join
puts secret
@marano
marano / robot.js
Created December 6, 2012 17:50
Shrimp Hunter
var aVera = true;
var Robot = function(robot) {};
var RobotState = function (rotateStep) {
data = {};
data.id = 0;
data.isLookingAtTarget = false;
data.timesShooting = 0;
data.rotateStep = rotateStep;
@marano
marano / robot.js
Created December 6, 2012 04:09
Shrimp Hunter 2000
var aVera = true;
var Robot = function(robot) {};
var RobotState = function (rotateStep) {
data = {};
data.id = 0;
data.isLookingAtTarget = false;
data.timesShooting = 0;
data.rotateStep = rotateStep;
@marano
marano / link_opener.rb
Created October 16, 2012 19:55
Quick and dirty way to get link content in ruby that handles redirects and https.