Skip to content

Instantly share code, notes, and snippets.

View lucascaton's full-sized avatar

Lucas Caton lucascaton

View GitHub Profile
@lucascaton
lucascaton / haml2erb.rb
Last active September 24, 2020 07:42 — forked from 3zcurdia/haml2erb.rb
HAML to ERB converter with herbalizer
#!/usr/bin/env ruby
# frozen_string_literal: true
require "httparty"
class Converter
def initialize(filename)
@content = File.open(filename).read
end
attr_reader :content
@lucascaton
lucascaton / heroku-db-url-to-spring-boot.sh
Created January 4, 2020 07:41 — forked from wwerner/heroku-db-url-to-spring-boot.sh
Parse Heroku DB URL into Spring Boot Datasource Environment Variables
# Two possibilities to parse a Postgres DB URL from heroku into environment variables
# that Spring Boot understands.
# You would need that, if you do not build on heroku but push docker images
# from another source
# Does not need bash. Works on alpine linux / busybox. Tested with openjdk:8-jdk-alpine base image.
export DATABASE_URL=postgres://user:password@host:port/database
# Naive way, would break with [@:/] in username or password.
DB_TYPE=$(echo $DATABASE_URL | awk -F'[:@/]' '{print $1}')"ql"
sudo ./certbot-auto certonly --manual -d 'example.com' -d '*.example.com' --agree-tos --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory
<p style="text-align: justify;">Sem dúvida, uma pergunta que recebo recorrentemente é: "Fernando, como ser um bom desenvolvedor?". Obviamente que não existe uma fórmula mágica, vou compartilhar um pouco do que aplico na minha vida e espero que você consiga bons resultados.</p>
<h3><strong>Código limpo</strong></h3>
<p style="text-align: justify;">Código limpo consiste basicamente em fazer exatamente o que o título diz: ter um código limpo. <strong>Código é como uma piada, se você tem que explicar, não é tão boa assim</strong>. Até mesmo um código ruim pode funcionar, e - acredite - eu vivo isso no meu dia a dia, tendo que manter um código funcionando que foi escrito por pessoas sem conhecimentos básicos da plataforma Salesforce. Por exemplo, muitas das <em>Triggers</em> que existem na plataforma hoje não são capazes de trabalhar com <strong><em>Bulk Insert</em></strong>. Eu sei que é triste, tem horas que chega a dar vontade de chorar, mas faz parte do nosso mundo de desenvolvimento e você nunca vai encontra

MySQL commands

  • Show table collation from a database:
show table status from <database>;
  • Show collation from an entire database;
@lucascaton
lucascaton / fix-wordpress-permissions.sh
Created September 10, 2016 07:28 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=/var/www/lucascaton_blog
require 'RMagick'
require 'capybara'
require 'launchy'
module Capybara::Recording
def start_recording
system "rm -f tmp/*"
end
def save_recording
@lucascaton
lucascaton / pre-commit
Created December 9, 2015 00:04 — forked from jonasschmidt/pre-commit
git pre-commit hook checking for RSpec :focus tags that were unintentionally left in the specs
#!/usr/bin/env ruby
if `git diff --cached spec` =~ /,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/
puts "\e[31mPlease focus and remove your :focus tags before committing :)"
exit 1
end
@lucascaton
lucascaton / iphone6.rb
Created September 23, 2015 23:24 — forked from alexeckermann/iphone6.rb
iPhone 6 Reservation Availability in Australia
# iPhone 6 Reservation Availability in Australia
# !! Please use responsibly. Personal use only !!
# `ruby iphone6.rb` - list all available models in all stores
# `ruby iphone6.rb R405` - list available models for a specific store, Rundle Place in this example.
require 'open-uri'
require 'json'
MODEL_NAMES = {
"MG4A2X/A" => "iPhone 6 Space Grey 128GB",
@lucascaton
lucascaton / XGH - PT-BR.txt
Last active September 10, 2015 07:41 — forked from banaslee/XGH - en.txt
eXtreme Go-Horse Process
Fonte: http://gohorseprocess.wordpress.com
1- Pensou, não é XGH.
XGH não pensa, faz a primeira coisa que vem à mente. Não existe
segunda opção, a única opção é a mais rápida.
2- Existem 3 formas de se resolver um problema, a correta, a errada e
a XGH, que é igual à errada, só que mais rápida.