Skip to content

Instantly share code, notes, and snippets.

Alex Ruzenhack alexruzenhack

View GitHub Profile
@alexruzenhack
alexruzenhack / domain_driven_design.md
Last active Mar 13, 2019
Summary of #ddd by Eric Evans
View domain_driven_design.md

The heart of software

  • Leaders within a team who understand the centrality of the domain can put their software project back on course.
  • Software developer is like a researche, both have the responsability to tackle the messiness of the real world through complicated domain that has never been formalized.
  • There are systematic ways of thinking that developers can employ to search for insight and produce effective models.

One. Crunching Knowledge

Ingredients of effective modeling

@alexruzenhack
alexruzenhack / pull-request-process.md
Created Dec 13, 2018
Processo de Pull Request #git #pullrequest
View pull-request-process.md
  1. Criar nova branch com as alterações realizadas na base do código
    • git checkout -b <branch name>
  2. Adicionar alterações na staging area
    • git add <. para adicionar tudo | path endereço do arquivo>
  3. Criar um commit descritivo da tarefa realizada, dos arquivos alterados
    • git commit -m "Descrever atividade"
  4. Puxar alterações da master para o repositório local
    • git pull origin master
  5. Atualizar a branch com as alterações da master, se existirem alterações
    • git merge master
@alexruzenhack
alexruzenhack / clean_code.md
Last active Nov 27, 2018 — forked from wojteklu/clean_code.md
Summary of #cleancode by Robert C. Martin #unclebob
View clean_code.md

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@alexruzenhack
alexruzenhack / How to create an enum in Java.java
Last active Nov 27, 2018
📙 This #enum implements static functions in enum to get self values, and a list of parameters.
View How to create an enum in Java.java
public enum Status {
P("Pending"),
A("Approved");
private String name;
Status(String name) {
this.name = name;
}
@alexruzenhack
alexruzenhack / full-backup-and-log-control.sql
Last active Nov 27, 2018
🐇 🐇 Protect your #sqlserver database with backup and control log volume
View full-backup-and-log-control.sql
-- ============================================================================
-- 1. Limitamos o tamanho do log a 200MB com variação de 50MB;
-- alter log size of database
USE [yourDatabase];
GO
ALTER DATABASE [yourDatabase]
MODIFY FILE
(NAME = yourDatabase_log,SIZE = 200MB, FILEGROWTH = 50MB);
GO
@alexruzenhack
alexruzenhack / emergency-repair-sqlserver.sql
Last active Nov 27, 2018
💉 Repair #sqlserver database into emergency mode
View emergency-repair-sqlserver.sql
-- step 01 - Set the database into emergency mode
ALTER DATABASE yourDatabase SET EMERGENCY;
-- step 02 - Emegency mode repair
ALTER DATABASE yourDatabase SET SINGLE_USER
DBCC CHECKDB(yourDatabase, REPAIR_ALLOW_DATA_LOSS);
-- steop 03 - Unlock the database setting it into multiuser again
ALTER DATABASE yourDatabase SET MULTI_USER;
@alexruzenhack
alexruzenhack / cut-sqlserver-log.sql
Last active Nov 27, 2018
✂️ Shrink log file of #sqlserver
View cut-sqlserver-log.sql
USE [nomeSeuBancoDeDados];
CHECKPOINT;
GO
CHECKPOINT; -- run twice to ensure database file wrap-around last transactions
GO
-- 200 MB
DBCC SHRINKFILE(nomeSeuBancoDeDados_log, 200);
@alexruzenhack
alexruzenhack / include-assets-per-controller.md
Last active Apr 20, 2017
🍕 add javascript asset per controller on page if the asset exists
View include-assets-per-controller.md

Rails assets per controller

Check if asset exists with find_asset before include it.

<!-- Include javascript per-controller - vendor plugins -->
<%= javascript_include_tag params[:controller] 
        if ::Rails.application.assets.find_asset("#{params[:controller]}.js") %>
@alexruzenhack
alexruzenhack / check-services-and-ports.md
Last active Nov 27, 2018
📋 Check witch ports are open and witch services are running #linux #wildfly
View check-services-and-ports.md

Verify services

Status of all services:

service --status-all

Status of any service:

service wildfly status
You can’t perform that action at this time.