Skip to content

Instantly share code, notes, and snippets.

View raulmontemayor's full-sized avatar

Raul Montemayor raulmontemayor

View GitHub Profile
public class Singleton {
private static Singleton INSTANCE = new Singleton();
private Singleton() {}
public static Singleton getInstance() {
return INSTANCE;
}
}
public class Contacto {
private static Contacto contacto;
private Contacto(Resources resource){
}
public Contacto getIntance(Resources res){
if(contacto == null){
contacto = new Contacto(resources);
}
/**
* A nasty method
*/
private int obtenerAno(Date FechaRegistro){...}
@raulmontemayor
raulmontemayor / getLog.xml
Created September 3, 2014 17:37
Eclipse Template - Import and create slf4j log
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<templates>
<template autoinsert="true" context="java" deleted="false" description="Import and create slf4j log" enabled="true" name="getLog">
${:import (org.slf4j.Logger, org.slf4j.LoggerFactory)}
/** Log de ${enclosing_type} */
private static final Logger LOG = LoggerFactory.getLogger(${enclosing_type}.class);
</template>
</templates>
package parte2;
import java.util.Date;
public class Amigo {
private String nombre;
private Date fechaNacimiento;
public Amigo(String nombre, Date fechaNacimiento) {
this.nombre = nombre;
/^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d/.test("2007-11-03T13:18")