Skip to content

Instantly share code, notes, and snippets.

View srbartlett's full-sized avatar

Stephen Bartlett srbartlett

View GitHub Profile
{"downtime":[2,3,2],"activity":[1,1],"connections":[3,2],"nutrition":[3,3],"sleep":[2,2]}
@srbartlett
srbartlett / CustomErrorController.java
Created February 22, 2017 23:25 — forked from jonikarppinen/CustomErrorController.java
Example of replacing Spring Boot "whitelabel" error page with custom error responses (with JSON response body)
package com.company.project.controllers;
import com.company.project.model.api.ErrorJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestAttributes;
{
"apiVersion": "v1",
"swaggerVersion": "1.2",
"basePath": "https://{{subdomain}}.apigee.net",
"resourcePath": "/v1/sms/messages",
"consumes": [
"application/json"
],
"produces": [
"application/json"
### Keybase proof
I hereby claim:
* I am srbartlett on github.
* I am srbartlett (https://keybase.io/srbartlett) on keybase.
* I have a public key whose fingerprint is 21D8 4197 C341 50A4 92CC DD32 3BAD 8743 6A5C 1C6D
To claim this, I am signing this object:
@srbartlett
srbartlett / process.conf.erb
Created October 14, 2013 02:47
foreman upstart template
start on starting <%= app %>-<%= name %>
stop on stopping <%= app %>-<%= name %>
respawn
exec su - <%= user %> --shell=/bin/bash -c 'cd <%= engine.root %>; trap '\''kill -WINCH $(jobs -p) && kill -QUIT $(jobs -p)'\'' EXIT; export PORT=<%= port %>;<% engine.env.each_pair do |var,env| %> export <%= var.upcase %>=<%= env %>; <% end %> <%= process.command %> >> <%= log %>/<%=name%>-<%=num%>.log 2>&1'