Skip to content

Instantly share code, notes, and snippets.

Américo Duarte americodls

Block or report user

Report or block americodls

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@americodls
americodls / Dockerfile
Last active May 20, 2019
Docker & Docker Compose para aplicações rails
View Dockerfile
FROM ruby:2.5.1
ARG user
ARG uid
RUN test -n "$user"
RUN test -n "$uid"
ENV BUILD_DEPS="build-essential"
ENV RAILS_GEM_DEPS="tzdata less postgresql-client"
View post-mortem-template.md

INCIDENT DATE - INCIDENT TYPE

Meeting

Waiving meetings

In some cases the IC might determine that a PM meeting for the incident isn't needed. If the IC decides to waive the meeting please replace the Meeting section with a note indicating the meeting has been waived (example: Meeting waived: Paul Mooring)

@americodls
americodls / function.rb
Created Jun 7, 2018
Create an object that is an improvement over Proc (curried by default and better inspection for debug)
View function.rb
class Function
attr_reader :arity, :source_location
def initialize(&block)
unless block_given?
message = "tried to create #{self.class.name} object without a block"
raise(ArgumentError, message)
end
@arity = block.arity
@americodls
americodls / rubocop.rb
Created Nov 10, 2017 — forked from skanev/rubocop.rb
A Rubocop wrapper that checks only added/modified code
View rubocop.rb
#!/usr/bin/env ruby
# A sneaky wrapper around Rubocop that allows you to run it only against
# the recent changes, as opposed to the whole project. It lets you
# enforce the style guide for new/modified code only, as opposed to
# having to restyle everything or adding cops incrementally. It relies
# on git to figure out which files to check.
#
# Here are some options you can pass in addition to the ones in rubocop:
#
@americodls
americodls / rubocop_pre_commit_hook
Created Oct 31, 2017 — forked from mpeteuil/rubocop_pre_commit_hook
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified.
View rubocop_pre_commit_hook
#!/usr/bin/env ruby
require 'english'
require 'rubocop'
ADDED_OR_MODIFIED = /A|AM|^M/.freeze
changed_files = `git status --porcelain`.split(/\n/).
select { |file_name_with_status|
file_name_with_status =~ ADDED_OR_MODIFIED
@americodls
americodls / sign_in.rb
Created Feb 17, 2015
Interface proposal for ServiceObject/Interactor/UseCase on rails
View sign_in.rb
class SessionsController < ApplicationController
def create
ToDoList::SignIn.new(sign_in_params).call({
success: ->(message) { redirect_to dashboard_user_path, notice: t(message) },
failure: ->(message) { render :new, error: t(message) }
})
end
end
module ToDoList
@americodls
americodls / mediator.js
Last active Sep 22, 2015
Pub/Sub pattern using only jQuery.
View mediator.js
window.mediator = $({});
$(function() {
mediator.on("foo:bar", fooBar);
mediator.trigger("foo:bar");
});
function fooBar(event) {
alert("Foo Bar");
}
You can’t perform that action at this time.