Skip to content

Instantly share code, notes, and snippets.

@osazemeu
osazemeu / CatchAllOptionsRequestsProvider.php
Created January 20, 2018 14:51 — forked from danharper/CatchAllOptionsRequestsProvider.php
Lumen with CORS and OPTIONS requests
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
/**
* If the incoming request is an OPTIONS request
* we will register a handler for the requested route
*/
class CatchAllOptionsRequestsProvider extends ServiceProvider {
@osazemeu
osazemeu / gist:e9a4b8312e7d2842b06ac9f5e8cf6896
Created October 10, 2017 12:32 — forked from harrisonde/gist:90431ed357cc93e12b51
Deploy Laravel 5 applications on AWS Elastic Beanstalk
# The following script will deploy a Laravel 5 applicaion on AWS Elastic Beanstalk.
# Add to .ebextensions at the root of your application and name your commands file (e.g., commands.config)
# -------------------------------- Commands ------------------------------------
# Use "commands" key to execute commands on the EC2 instance. The commands are
# processed in alphabetical order by name, and they run before the application
# and web server are set up and the application version file is extracted.
# ------------------------------------------------------------------------------
commands:
01updateComposer:
@osazemeu
osazemeu / 1_triggers.sql
Last active October 4, 2017 11:09 — forked from fritzy/1_triggers.sql
Get table change notifications from Postgres as JSON
CREATE OR REPLACE FUNCTION table_update_notify() RETURNS trigger AS $$
DECLARE
id bigint;
BEGIN
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
id = NEW.id;
ELSE
id = OLD.id;
END IF;
PERFORM pg_notify('table_update', json_build_object('table', TG_TABLE_NAME, 'id', id, 'type', TG_OP)::text);
@osazemeu
osazemeu / rails http status codes
Created August 19, 2017 04:38 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@osazemeu
osazemeu / capybara cheat sheet
Created August 17, 2017 18:40 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@osazemeu
osazemeu / introrx.md
Created July 7, 2017 13:45 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@osazemeu
osazemeu / 1 Gist conventions
Created June 17, 2017 12:13 — forked from PavloBezpalov/1 Gist conventions
Deploy Rails 5.0.0.beta3 to VPS(Ubuntu 14.04.4 LTS). Nginx, Puma, Capistrano3, PostgreSQL, RVM.
<<APP>> change this variables
@osazemeu
osazemeu / docker-ecs-tools.sh
Created June 12, 2017 15:47 — forked from yetanotherchris/docker-ecs-tools.sh
Docker ECS tools installation for Amazon Linux
echo "======= Installing Additional tools ======= "
# Docker
sudo yum -y install docker
sudo service docker restart
sudo systemctl status docker | grep active
# Python and PIP
echo "Installing Python and Pip"
sudo yum -y install python-setuptools
#!/usr/bin/env bash
###
# Updates a pre-configured Amazon EC2 Container Service (ECS) cluster.
#
# Build a docker image in CWD, tag it and push it to hub.docker.com.
# Then Update an ECS services to run that newly available images.
#
# This script receives as a input a filename (Relative to this directory).
#
# That file must set the following Environment variables .