Skip to content

Instantly share code, notes, and snippets.

View alexruzenhack's full-sized avatar

Alex Ruzenhack alexruzenhack

View GitHub Profile
@alexruzenhack
alexruzenhack / keybase.md
Created June 17, 2019 04:32
My keybase verification

Keybase proof

I hereby claim:

  • I am alexruzenhack on github.
  • I am alexruzenhack (https://keybase.io/alexruzenhack) on keybase.
  • I have a public key ASC34fYJAaMWmK-pb0_JSKiXSKWCwM4_AyX2KpBA2kC-hAo

To claim this, I am signing this object:

@alexruzenhack
alexruzenhack / domain_driven_design.md
Last active June 2, 2024 18:59
Summary of #ddd by Eric Evans

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 December 13, 2018 16:37
Processo de Pull Request #git #pullrequest
  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 / apsnetcore-logging.md
Created November 28, 2018 14:19
Customizing ASP.NET Core Logging #aspnetcore #log
@alexruzenhack
alexruzenhack / clean_code.md
Last active November 27, 2018 14:29 — forked from wojteklu/clean_code.md
Summary of #cleancode by Robert C. Martin #unclebob

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 November 27, 2018 14:28
📙 This #enum implements static functions in enum to get self values, and a list of parameters.
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 November 27, 2018 14:30
🐇 🐇 Protect your #sqlserver database with backup and control log volume
-- ============================================================================
-- 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 November 27, 2018 14:29
💉 Repair #sqlserver database into emergency mode
-- 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 November 27, 2018 14:30
✂️ Shrink log file of #sqlserver
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 April 20, 2017 02:41
🍕 add javascript asset per controller on page if the asset exists

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") %>