Skip to content

Instantly share code, notes, and snippets.

View eb-deployer-ls.sh
.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.
View eb_deployer.yml
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
View eb_deployer.rake
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
View eb-deployer-database.yml
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 Apr 5, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@marano
marano / generate_secret.rb
Created Nov 7, 2015
Generate random secret
View generate_secret.rb
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 Dec 6, 2012
Shrimp Hunter
View robot.js
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 Dec 6, 2012
Shrimp Hunter 2000
View robot.js
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 Oct 16, 2012
Quick and dirty way to get link content in ruby that handles redirects and https.
View link_opener.rb