Skip to content

Instantly share code, notes, and snippets.

View bisignam's full-sized avatar
🌈

Mario Bisignani bisignam

🌈
  • Migros Online / Search Team
  • Zürich, Switzerland
View GitHub Profile
public void printTree(Node root) {
if (root.right != null) {
printTree(root.right, true, "");
}
System.out.println(root.data);
if (root.left != null) {
printTree(root.left, false, "");
}
}
@bisignam
bisignam / UntestableService.java
Last active April 24, 2017 18:42
An example of untestable service
@Service
public class UntestableService {
private AnotherService myDependency;
UntestableService(){
this.myDependency = SpringFactory.createMyDependency();
}
}
@bisignam
bisignam / TestableService.java
Last active April 24, 2017 18:40
An example of testable service
@Service
public class TestableService {
private AnotherService myDependency;
@Autowired
TestableService(AnotherService anotherService){
this.myDependency = anotherService;
}
public final static Constants {
public final static String COMPLEX_QUERY = "SELECT * FROM A_VERY_COMPLEX_QUERY";
}
@bisignam
bisignam / keybindings.json
Created May 21, 2017 19:35 — forked from yuki-takei/keybindings.json
Visual Studio Code - Eclipse Keybindings (Win, Linux)
[
{
"key": "ctrl+d",
"command": "editor.action.cutLines",
"when": "editorTextFocus"
},
{
"key": "ctrl+o",
"command": "workbench.action.gotoSymbol"
},
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.oauth2.provider.code.AuthorizationRequestHolder;
import org.springframework.security.oauth2.provider.code.RandomValueAuthorizationCodeServices;
import org.springframework.util.Assert;
public class HazelcastAuthorizationCodeServices extends RandomValueAuthorizationCodeServices implements InitializingBean {
protected IMap<String, AuthorizationRequestHolder> authorizationCodeStore = null;
@bisignam
bisignam / .gitconfig
Created July 6, 2018 09:52
git alias for retrieving all the commits since the last maven release
[alias]
release-commits = "!f() { LAST_RELEASE_HASH=`git log --grep \"prepare for next development iteration\" -n 1 --format=format:\"%h\"`; git log --oneline $LAST_RELEASE_HASH..HEAD; }; f"
@bisignam
bisignam / UnderstandStepVerifier.java
Last active July 27, 2018 11:44
[SPRING-REACTOR] Test class that summarizes how to test infinite Flux(es) with StepVerifier
package ch.exm.generisk.notifications;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
sudo find / -xdev -type f -size +100M -exec ls -lah {} \;
@bisignam
bisignam / Find id in ger reference via awk
Created October 11, 2018 14:54
Awk trim leading zeros
gsub ("^0*", "", string);