Skip to content

Instantly share code, notes, and snippets.

@hortega
hortega / TwilioRequestValidatorFilter.java
Created November 29, 2016 19:47
Files for Twilio guide about validating Twilio requests in Servlet project
package guide;
import com.twilio.security.RequestValidator;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
package guide;
import com.twilio.twiml.Say;
import com.twilio.twiml.TwiMLException;
import com.twilio.twiml.VoiceResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@hortega
hortega / QueueConsumer.java
Last active January 21, 2020 22:14
ExecutorCompletionService example to asynchronously process elements from a queue
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Queue;
import java.util.Random;
import java.util.concurrent.*;
public class QueueConsumer {
private static final Logger LOGGER = LoggerFactory.getLogger(QueueConsumer.class);
@hortega
hortega / bot.clj
Created June 25, 2013 16:11 — forked from cgrand/bot.clj
;; * paste your code
;; * add a comment at the top telling which function to call
@hortega
hortega / bot.clj
Last active December 18, 2015 23:09 — forked from cgrand/bot.clj
(defn right [[x y]]
{2 [(inc x) y]})
(defn left [[x y]]
{4 [(dec x) y]})
(defn down [[x y]]
{3 [x (inc y)]})