Skip to content

Instantly share code, notes, and snippets.

@baybatu
baybatu / use-git-profile-by-directory.md
Created June 30, 2021 15:15
Using git profiles by current directory

~/.gitconfig:

[includeIf "gitdir:~/workspace/project1/**"]
    path = .gitconfig.project1
[includeIf "gitdir:~/workspace/project2/**"]
    path = .gitconfig.project2

~/.gitconfig.project1:

@baybatu
baybatu / uniq-tekillestirme-yontemi.md
Last active April 3, 2021 13:55
uniq aracinin sadece komsu satirlari tekillestirmesi / uniq tool makes only adjacent rows unique

uniq araci sadece komsu satirlari kullanarak tekillestirme yapar.

$ cat test.txt
a
a
a
b
b
c
@baybatu
baybatu / yaml-cift-tirnak.md
Last active May 3, 2021 11:59
Iyi pratik ornegi olarak Yaml dosyalarinda cift tirnak kullanimi

Yaml dosyalarda yes, on, true gibi degerlerin hepsi boolean true degerine eslestiriliyor. Bu da gozden kactiginda tespiti zor buglara neden oluyor.

Bu tarz sorunlardan bastan kacinmak icin string alanlari cift tirnak ile cevrelemek iyi bir pratik.

🚫 Kotu ornek:

watermark:
  - no
 - yes
@yusufcakal
yusufcakal / LoggingFilter.java
Last active February 8, 2021 08:01
Helps you easy to tracing logs to request and response via Spring
import com.dolap.settlement.model.request.CreateSettlementRequest;
import com.dolap.settlement.model.response.GetSettlementResponse;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.logging.log4j.util.Strings;
import org.slf4j.MDC;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html
Checkstyle is very configurable. Be sure to read the documentation at
@baybatu
baybatu / mjml-responsive-mails.md
Created December 25, 2020 11:20
MJML : Markup language for responsive mails
@baybatu
baybatu / finagle-http2-frame-logger.md
Last active December 24, 2020 10:30
Log http2 frames on a finagle service
import com.twitter.finagle.http2.param.FrameLoggerNamePrefix
val service =
        Http
          .client
          .withLabel("service-label")
          .configured(FrameLoggerNamePrefix(this.getClass.getName))
          .withHttp2
          .newService("localhost:8080")
@baybatu
baybatu / active-forks.md
Created October 28, 2020 13:22
Find most active github forks easily
@yusufcakal
yusufcakal / TextMasker.java
Created January 22, 2020 11:31
It can use text mask to bounds of text certain begin and end indices. Enjoy your data driven test via spock framework :)
public class TextMasker {
public static String mask(String text, int begin, int end) {
if (Objects.isNull(text)) {
return null;
}
if (areIndexesInBoundOfText(text, begin, end)) {
String firstDisplayablePart = text.substring(0, begin);
String secondDisplayablePart = text.substring(end);
@yusufcakal
yusufcakal / gist:73bba046739551dfe31dd5134b9e375c
Created June 11, 2019 16:39
SpringOne19' Istanbul Useful Links
https://www.callicoder.com/hibernate-spring-boot-jpa-embeddable-demo/
https://www.baeldung.com/java-optional-or-else-vs-or-else-get
https://refactoring.guru/smells/feature-envy
https://www.mkyong.com/unittest/junit-4-tutorial-2-expected-exception-test/
https://www.javacodegeeks.com/2013/02/testing-expected-exceptions-with-junit-rules.html
https://www.geeksforgeeks.org/luhn-algorithm/
http://baddotrobot.com/blog/2012/03/27/expecting-exception-with-junit-rule/
https://github.com/r2dbc
https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html
https://github.com/snicoll-demos/spring-boot-migration/tree/master/src/main/java/com/example/speakerservice