Skip to content

Instantly share code, notes, and snippets.

View cchacin's full-sized avatar
🎯
Focusing

Carlos Chacin cchacin

🎯
Focusing
View GitHub Profile
@cchacin
cchacin / Main.scala
Created September 7, 2012 18:36
ParallelAkka
import akka.actor._
import akka.util.Timeout
import concurrent.{Promise, Future, Await}
import concurrent.util.Duration
import concurrent.util.duration._
import collection.mutable.ListBuffer
import akka.pattern.after
import concurrent.ExecutionContext
import java.util.concurrent.{Executor, Executors}
import sys.process._
@cchacin
cchacin / pom.xml
Last active December 18, 2015 04:19
JavaEE 6 -> TomEE 1.5.2 pom
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
@cchacin
cchacin / pom.xml
Created June 6, 2013 21:04
CXF WADL to Java Maven Plugin
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-wadl2java-plugin</artifactId>
<version>2.7.5</version>
<configuration>
<sourceRoot>${basedir}/src/main/java</sourceRoot>
<wadlOptions>
<wadlOption>
<wadl>${basedir}/src/test/resources/sample.wadl</wadl>
<impl>true</impl>
@cchacin
cchacin / pom.xml
Last active December 29, 2015 15:49
Simple JavaEE 6 -> Testing
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sample.dojo</groupId>
<artifactId>sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sample</name>
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"
}
@cchacin
cchacin / FizzBuzz.java
Last active April 11, 2020 20:51
Java 8 FizzBuzz
public class FizzBuzz {
static java.util.function.Predicate<Integer> divBy(int n) { return i -> (i % n) == 0;}
static String fizzBuzz(Integer intIn){
String fizz = divBy(3).test(intIn) ? "Fizz" : "";
String buzz = divBy(5).test(intIn) ? "Buzz" : "";
return (fizz.isEmpty() && buzz.isEmpty()) ? intIn.toString() : fizz + buzz;
}
@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>