Skip to content

Instantly share code, notes, and snippets.

View cchacin's full-sized avatar
🎯
Focusing

Carlos Chacin cchacin

🎯
Focusing
View GitHub Profile
409 Conflict
{
"status": 409,
"code": 40924,
"property"; "name",
"message": "A Directory named 'Avengers' already exists",
"developerMessage": "A directory named 'Avengers' already exists. If you have a stale local cache, please expire it now",
"moreInfo": "http//example.com/docs/api/errors/40924"
}
@Path("/books")
public class BookResource {
// less bandwidth
@GET
@Path("/{id}")
public Response getBook(@PathParam("id") long id, @Context Request request){
Book myBook = getBookFromDB(id);
CacheControl cc = new CacheControl();
#!/bin/sh
# NOTES:
# - This script takes only one argument (desired path to create the app)
# - It uses uses coffeescript, stylus and jade to as sample files/code
# - Its intended to be just an example for getting started, and nothing more
# - For more info on Polvo, check the project Site and README:
# http://polvo.io
# https://github.com/polvo/polvo
// Thanks Daniel Soro @dvlc_
public void contributeToOpenSource() {
boolean stillInterestedAndHavingFun = true;
int taskSize = 1; // start small!
contributing:
while (stillInterestedAndHavingFun) {
Task task = findSomethingInteresting(taskSize++);
if (!task.hasJira()) {
createJira(task);
} else {
@cchacin
cchacin / pom.xml
Created October 8, 2014 01:42
Production code in Java 7 and tests with Java 8
<properties>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.testTarget>1.8</maven.compiler.testTarget>
<maven.compiler.testSource>1.8</maven.compiler.testSource>
</properties>
@cchacin
cchacin / DbMigrator
Created October 9, 2014 15:15
Database migrator with Flyway
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.MigrationInfo;
import org.slf4j.Logger;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.ejb.EJBException;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;
@cchacin
cchacin / update-gh-pages.sh
Last active August 29, 2015 14:10
Script to update gh-pages with maven reports
#!/bin/sh
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
echo -e "Starting to update gh-pages\n"
#copy data we're interested in to other place
#mkdir -p $HOME/reports
cp -R ./target/site $HOME/.
#go to home and setup git
cd $HOME
@cchacin
cchacin / openejb-jar.xml
Created November 21, 2014 14:25
TomEE + Jackson
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openejb.org/openejb-jar/1.1">
<pojo-deployment class-name="jaxrs-application">
<properties>
cxf.jaxrs.providers = com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider
</properties>
</pojo-deployment>
</openejb-jar>
@cchacin
cchacin / openejb-jar.xml
Created November 21, 2014 22:43
Apache TomEE Jettison configuration
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openejb.org/openejb-jar/1.1">
<pojo-deployment class-name="jaxrs-application">
<properties>
cxf.jaxrs.providers = jsonProvider
</properties>
</pojo-deployment>
</openejb-jar>
@cchacin
cchacin / Dependencies.java
Created November 26, 2014 01:27
Arquillian Dependencies from pom.xml
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import java.io.File;
import java.util.Date;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class Dependencies {