Skip to content

Instantly share code, notes, and snippets.

Michael Pratt michael-pratt

Block or report user

Report or block michael-pratt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@michael-pratt
michael-pratt / RequestAndResponseLoggingFilter.java
Last active Apr 16, 2019
Simple Spring Boot Request and Response Logging Filter
View RequestAndResponseLoggingFilter.java
// Adapted from https://gist.github.com/int128/e47217bebdb4c402b2ffa7cc199307ba
package com.elvtn.logging;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
@michael-pratt
michael-pratt / tooltip.php
Created Feb 7, 2019
customize-events-calendar-popup-tooltip-php
View tooltip.php
<?php
/**
* Please see single-event.php in this directory for detailed instructions on how to use and modify these templates.
*
* Override this template in your own theme by creating a file at:
*
* [your-theme]/tribe-events/month/tooltip.php
* @version 4.6.21
*/
?>
@michael-pratt
michael-pratt / single-event.php
Created Feb 7, 2019
customize-events-calendar-popup-single-event-php
View single-event.php
<?php
// Define default values to protect against events not having tickets
$additional_data = array();
$additional_data['price'] = "";
$additional_data['stock'] = "";
// Get ticket prices and quantity; this works specifically for WooCommerce
// tickets only and will need to be changed if you use other types such
// as RSVP tickets.
if ( class_exists('Tribe__Tickets_Plus__Commerce__WooCommerce__Main') )
@michael-pratt
michael-pratt / BootDeployPlugin.groovy
Created Oct 8, 2018
Extending Spring Boot bootJar Task
View BootDeployPlugin.groovy
package com.elvtn
import org.gradle.api.Plugin
import org.gradle.api.Project
/**
* Custom plugin that adds a new <code>bootDeploy</code> task for any
* project that depends on the Spring Boot gradle plugin. This new task
* depends on the existing <code>bootJar</code> task, and adds some new
@michael-pratt
michael-pratt / MultipleEurekaInstanceApplication.java
Created Aug 30, 2018
Registering multiple instances in Eureka from one application
View MultipleEurekaInstanceApplication.java
package com.myorg;
import com.netflix.appinfo.ApplicationInfoManager;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.AbstractDiscoveryClientOptionalArgs;
import com.netflix.discovery.DiscoveryClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@michael-pratt
michael-pratt / SystemHealthIndicator.java
Created Jul 25, 2018
Spring Boot System and JVM HealthIndicator
View SystemHealthIndicator.java
@Configuration
public class SystemHealthIndicator
{
@Bean
public SystemHealthIndicator systemHealthIndicator()
{
return new SystemHealthIndicator();
}
/**
@michael-pratt
michael-pratt / InetTester.java
Created Jul 3, 2018
Java slow DNS resolution test
View InetTester.java
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.*;
/**
* Test app to show DNS resolution times for IP -> hostname.
*/
public class InetTester
{
@michael-pratt
michael-pratt / index.js
Created Aug 1, 2016
Custom slack command hosted on Heroku with Node.js
View index.js
var unirest = require('unirest');
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
app.set('port', (process.env.PORT || 5000));
// Replace these with your own tokens
You can’t perform that action at this time.