Skip to content

Instantly share code, notes, and snippets.

View pdtyreus's full-sized avatar

P. Daniel Tyreus pdtyreus

View GitHub Profile
@pdtyreus
pdtyreus / ConsoleChat.java
Created January 1, 2017 19:58
Example console-based test program for conversation-kit
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import com.synclab.conversationkit.builder.JsonGraphBuilder;
import com.synclab.conversationkit.impl.DirectedConversationEngine;
import com.synclab.conversationkit.impl.MapBackedState;
import com.synclab.conversationkit.model.IConversationSnippet;
import com.synclab.conversationkit.model.IConversationState;
import com.synclab.conversationkit.model.SnippetContentType;
import com.synclab.conversationkit.model.SnippetType;
import com.synclab.conversationkit.model.UnmatchedResponseException;
@pdtyreus
pdtyreus / SlackPostMessageWithAttachments.js
Created September 8, 2016 22:15
Slack chat.postMessage with attachments
var http = require("https");
var querystring = require('querystring');
//2 attachments as JavaScript Objects
var attachments = [{
fallback: "Attachment 1 Fallback",
title: "This is Attachment 1",
text: "Attachment 1 Text",
color: "#3964db"
}, {
@pdtyreus
pdtyreus / AmplitudeService.java
Last active February 14, 2016 01:04
Java Amplitude Service for sending Amplitude events server side. Uses Jackson for JSON serialization.
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URI;
import java.util.Arrays;
import java.util.HashMap;
@pdtyreus
pdtyreus / Neo4jHealthCheck.java
Created May 7, 2015 21:40
Simple Dropwizard HealthCheck for a Neo4j server
import com.codahale.metrics.health.HealthCheck;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import javax.ws.rs.core.MediaType;
public class Neo4jHealthCheck extends HealthCheck {