Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Working in a new open source project

Alexsandro Souza apssouza22

💭
Working in a new open source project
View GitHub Profile
View assert-tovalidade
import static org.springframework.util.Assert.greaterThan;
import static org.springframework.util.Assert.notBlank;
import static org.springframework.util.Assert.notNull;
...
public final class User {
public User(String firstName, String lastName, int age, Set<CreditCard> cards) {
this.firstName = notBlank(firstName, "Blank first name: %s", firstName);
this.lastName = notBlank(lastName, "Blank last name: %s", lastName);
this.age = greaterThan(17, age, "The user must be 18 or older");
this.cards = notNull(cards, "Invalid credit card set");
View getUncaughtExceptionHandler
Thread.getUncaughtExceptionHandler()
.uncaughtException(
Thread.currentThread(),
new IllegalStateException("Resource leak: finalizer fallback cleaned up")
);
View gist:cfe5a6b36193d3b0ff5aa4902b37b644
The term “Microservices Architecture” is now a popular term and in order to keep updated as a software developer, I’ve been putting some effort to get a good understanding about this architecture and the better way of implementing it in Java using Spring technologies.
I was working in a nice company with a great team and a good tech stack, however, we were not using the cutting edge Java features such as Java 8 and Microservices architectures in that moment, so I had to start looking for that knowledge outside the company. I wanted to play with the Java 8 and Microservices and the best way of doing it is hands on code, building something, then I decided to create a To Do system using as many fun stuffs as possible and I will try to write a series of posts talking about this experience.
The intention of this blog series is to have a source code walkthrough with many concepts and technologies put in place and combined within a whole system composed with different microservices. I’m not planning to go deep in th
View multipleitems
case "multipleitems":
for (var i = SQLResults.length - 1; i >= 0; i--) {
if(JSON.parse(SQLResults[i].product).length > 1){
result++;
}
}
returnObj.result = result;
returnObj.message = "Total of orders with minimum 2 orders";
break;
View Palindrome.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
*
* @author apssouza
View gist:3b8afdee0dfe59302c99
var class = function(){
return {
myPublicMethod : function(){
},
otherPublicMethod : function(){
}
}
}
View Worker.php
<?php
interface Worker
{
public function getCommand();
public function done($stdout, $stderr);
public function fail($stdout, $stderr, $status);
}
View money.js
var Money = (function(){
function Money(qty) {
this.whole = 0;
this.cents = 0;
this.add(qty);
}
Money.prototype.calc = function() {
while (this.cents > 100) {
this.cents -= 100;
this.whole += 1;
View gist:af9df91a545a62554f0b
<?php
/**
* As configurações básicas do WordPress.
*
* Esse arquivo contém as seguintes configurações: configurações de MySQL, Prefixo de Tabelas,
* Chaves secretas, Idioma do WordPress, e ABSPATH. Você pode encontrar mais informações
* visitando {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. Você pode obter as configurações de MySQL de seu servidor de hospedagem.
*
* Esse arquivo é usado pelo script ed criação wp-config.php durante a