Skip to content

Instantly share code, notes, and snippets.

View jreyes's full-sized avatar

Johann Reyes jreyes

  • Vaporware Corp
  • Miami, Fl
View GitHub Profile
@jreyes
jreyes / web.xml
Created January 3, 2012 02:22
REST with Jersey
<servlet>
<servlet-name>Jersey</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.vaporwarecorp.rest.server</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
@jreyes
jreyes / ElementoQuimicoServicio.java
Created January 3, 2012 02:28
REST Server Service
public class ElementoQuimicoServicio
{
private ElementoQuimicoDAO dao = new ElementoQuimicoDAO();
public List<ElementoQuimico> encontrarTodos()
{
return dao.encontrarTodos();
}
public ElementoQuimico encontrarPorNumeroAtomico( @PathParam("id") int numeroAtomico )
@jreyes
jreyes / ElementoQuimicoServicio.java
Created January 3, 2012 02:28
REST Server annotated service
@Path("/elementos")
public class ElementoQuimicoServicio
{
private ElementoQuimicoDAO dao = new ElementoQuimicoDAO();
@GET
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public List<ElementoQuimico> encontrarTodos()
{
return dao.encontrarTodos();
@jreyes
jreyes / ElementoQuimico.java
Created January 3, 2012 05:04
REST Server not annotated
public class ElementoQuimico
{
// ------------------------------ FIELDS ------------------------------
private String nombre;
private int numeroAtomico;
private String simbolo;
@jreyes
jreyes / ElementoQuimico.java
Created January 3, 2012 05:05
REST Server annotated
@XmlRootElement
public class ElementoQuimico
{
// ------------------------------ FIELDS ------------------------------
private String nombre;
private int numeroAtomico;
private String simbolo;
public class ElementoQuimicoDAO
{
// -------------------------- OTHER METHODS --------------------------
public List<ElementoQuimico> encontrarTodos()
{
List<ElementoQuimico> lista = new ArrayList<ElementoQuimico>();
Connection c = null;
String sql = "SELECT * FROM elemento_quimicos ORDER BY numero_atomico";
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ThreadPoolExample
{
// --------------------------- main() method ---------------------------
public static void main( String[] args )
{
final long start = System.currentTimeMillis();
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.github.com/jreyes/5993810/raw/496a4991a528af1d56e9e984d5034cc8199f37fd/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@jreyes
jreyes / designer.html
Last active August 29, 2015 14:22
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
@jreyes
jreyes / SomeActivity.java
Created April 13, 2016 03:31
Strict development
if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectAll()
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()