Skip to content

Instantly share code, notes, and snippets.

View campezzi's full-sized avatar

Thiago Campezzi campezzi

View GitHub Profile
@campezzi
campezzi / docker-compose.yml
Created September 7, 2016 11:08
PostGres Provisioning with docker-compose
version: '2'
services:
dev_db:
image: "postgres:9.5"
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=dev_database
ports:

A “Rosetta Stone” project to learn new web frameworks. Try to figure out the ideal path to learn a new programming language or framework - a kind of project that uses most features of regular web applications, but is reasonably simple to build. After that sample application is built, the programmer should feel confident about trying the language/framework in production, knowing that he’ll be able to perform a good portion of the work (of course there are always some app-specific requirements that cause problems, but that’s fine as long as the bulk of the work can be tackled with confidence).

  • CRUD
  • Serializing and deserializing JSON
  • Consuming third-party REST APIs
  • Data validation
  • User authentication + sessions
  • Database IO
  • Disk IO
  • Long running background tasks
@campezzi
campezzi / ecs-cli-commands.sh
Last active February 22, 2021 02:02
Amazon ECS deployment using the ecs-cli
# Full documentation: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI.html
# Replace the cluster name, keypair, exposed ports etc. as necessary.
# Install the ECS CLI and make it executable
sudo curl -o /usr/local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest
sudo chmod +x /usr/local/bin/ecs-cli
# Configure the CLI (login details, region and cluster name)
ecs-cli configure --region ap-southeast-2 --access-key $AWS_ACCESS_KEY_ID --secret-key $AWS_SECRET_ACCESS_KEY --cluster CreateBTATaskUI
@campezzi
campezzi / gulpfile.js
Created March 24, 2015 23:20
Gulp + Browserify + Reactify + Watch + LiveReload
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var reactify = require('reactify');
var notify = require("gulp-notify");
var livereload = require('gulp-livereload');
var scriptsDir = './src/js';
var buildDir = './public/js';
@campezzi
campezzi / gist:a5ec0ec17497df2d081d
Last active August 29, 2015 14:05
PHPThumb - Rotate image based on orientation
// Get PHPThumb from: https://github.com/masterexploder/PHPThumb
App::import('Vendor', 'PHPThumb', array('file' => 'PHPThumb/ThumbLib.inc.php'));
try {
$image = PhpThumbFactory::create($file_path, array('jpegQuality' => 75));
} catch (Exception $e) {
$this->outputError(array('unknown_error' => 'unknown_error'));
}
$exif = @exif_read_data($file_path);
if (!empty($exif['Orientation'])) {
$orientation = $exif['Orientation'];