Skip to content

Instantly share code, notes, and snippets.

View oscarryz's full-sized avatar

Oscar Reyes oscarryz

View GitHub Profile
import java.util.function.BiConsumer;
import java.util.Arrays;
import java.util.List;
class SimpleClass {
void methodA(String a, String b) {
System.out.printf("%s %s%n", a, b);
}
}
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class Mano {
if ( apparentlyImportantValue);
doSomething();
import lombok.Data;

@Data
class Empleado {
    private final Departamento departamento;
    private final String nombre;
}

@Data

class Departamento {

Sooo...

I thought it would be easier to setup goimports to use it with vim, and probably it is, but I had a lot of problems on the way.

Here's a quick summary of what I did at the end.

Note: I already had go installed and my GOPATH envrionment variable set.

  1. If fish shell is the default shell change it to something else ( I reverted to bash)
@oscarryz
oscarryz / Dagger 2 example.md
Last active September 11, 2021 11:36
Dagger 2 example

This example contains initially 3 java files:

  • SearchApp.java Has the main method
  • SearchInPage.java Perfoms the search of a keyword in a string
  • HttpClient.java Fetch a webpage

SearchInPage has a dependency on HttpClient, this example is to show how Dagger 2 can be used as Dependency Injection framework.

With Dagger 2 we change the dependency by adding the @Inject annotation, and we add 2 more clases: a Module and a Component which will be used by Dagger 2 to generate the required code to satisfy the dependency injection

var input = "elPj";
undefined
var re = /^PJ|JJ/i
undefined
re.test(input)
false
input = "pJz"
"pJz"
re.test(input)
true
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<script type="application/javascript">
function random(inRange) {
return Math.floor((Math.random()*inRange)+1);
import java.io.*;
import java.net.URL;
import java.util.*;
import java.util.regex.*;
import javax.servlet.http.*;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"regexp"
"strings"
)