Skip to content

Instantly share code, notes, and snippets.

View wrpinheiro's full-sized avatar
😳
dazed and confused

Wellington Ricardo Pinheiro wrpinheiro

😳
dazed and confused
View GitHub Profile
@wrpinheiro
wrpinheiro / somaNumPares.java
Last active April 10, 2020 20:33
algoritmos-corretude
public int somaNumPares(int[] A) {
int i = 0;
int soma = 0;
int n = A.length;
while(i < n) {
if(A[i] % 2 == 0)
soma = soma + A[i];
i++;
}
@wrpinheiro
wrpinheiro / Main.java
Last active April 28, 2017 02:36
Minio error
public class Main {
public static void main(String[] args) throws Exception {
MinioClient minioClient = new MinioClient("http://localhost:9000", "minotestkey", "miniotestsecret");
minioClient.makeBucket("test-bucket");
}
}
{"swagger":"2.1","info":{"version":"v1","title":"Dead Code Detection Service","contact":{"name":"Wellington Pinheiro"}},"basePath":"/api","tags":[{"name":"Repository controller"}],"schemes":["http","https"],"paths":{"/repository":{"get":{"tags":["Repository controller"],"summary":"List all repositories analyzed. This is a simplified view of repository without the code smells.","description":"","operationId":"getRepositories","consumes":["application/json"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":"Zero or more repositories found"}}},"post":{"tags":["Repository controller"],"summary":"Create a repository.","description":"","operationId":"addRepository","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","description":"Repository to be added and analyzed. The supported languages are:JAVA, ADA, CPP and FORTRAN","required":false,"schema":{"$ref":"#/definitions/RepositoryRequest"}}],"responses":{"200":{"description":"The
@wrpinheiro
wrpinheiro / index.html
Created February 5, 2017 23:25
Example of how to use the Formidable package to parse Formdata in a Node.js application
<!DOCTYPE html>
<html>
<head>
<title>FormData, Node and Formidable Example</title>
</head>
<body>
<button onClick="buttonClicked()">Click me</button>
<script src="https://code.jquery.com/jquery-3.1.1.js"></script>
<script type="text/javascript" charset="utf-8" async defer>
@wrpinheiro
wrpinheiro / TopologicalSort.groovy
Created August 30, 2016 16:15
Topological Sort Example
import java.util.ArrayDeque;
import java.util.Deque;
class TopologicalSort {
static final int NUM_VERTEXES = 7
void applyTopologicalSortLocally(Graph g, Integer vertex, Set<Integer> visited, Deque<Integer> stack) {
visited.add(vertex)
g.getAdjacentVertexes(vertex).each { adjVertex ->
if (!visited.contains(adjVertex)) {
@wrpinheiro
wrpinheiro / somatoria-fechada-1-n.md
Last active August 9, 2016 23:04
Forma fechada da somatória de 1 até n

somatária de 1 à n = somatoria(n)

Para n par

para n = 6 temos: somatoria(6) = 1 + 2 + 3 + 5 + 6

     2 + 5 = 7
    +-----------+
@wrpinheiro
wrpinheiro / intro-js-node.md
Last active June 1, 2016 18:47
Introduction to Javascript and Node JS

Introduction to Javascript & Node JS

This is a small guide that aims you to learn some Node JS and, of course, Javascript! This is not a reference nor a detailed guide, it's just a start up point.

A brief introduction

In the begining there were HTML. I was funny, but not that funny, because it was...static! We were not able deal with most user interations only with HTML. Then something happened which unleashed the power of our imagination...we learned to talk! No, it's not that! Then JS appeared to make our applications more attractive! With JS we were able to break the limitations imposed by the static HTML and now we live in a world of dynamic content. Note that everything we talked is related to JS running in the browser context, something that we call client side JS.

As time gone by, people have increased their interest in JS, due to its easyness, and started thinking: wouldn't this JS able to run on the server side either? And then something happened which unleashed...yes, then Node JS came in!

@wrpinheiro
wrpinheiro / intro-java.md
Last active May 24, 2016 20:11
java-introduction

Introduction to Java

Installing tools

brew cask install java

import React from 'react'
import { render } from 'react-dom'
var ProductCategoryRow = React.createClass({
render: function() {
return (<tr><th colSpan="2">{this.props.category}</th></tr>);
}
});
var ProductRow = React.createClass({
@wrpinheiro
wrpinheiro / TwoLoopsWithObjects.java
Created February 10, 2016 22:49
Observando JIT em ação com primitivos
public class TwoLoopsWithObjects {
public static void main(String[] args) {
StringBuilder sb = new StringBuilder();
Integer i = new Integer(0);
Integer max = new Integer(100000);
while (i.intValue() < 100000) {
Integer j = i;
long start = System.nanoTime();