Skip to content

Instantly share code, notes, and snippets.

View jbrackett's full-sized avatar

Josh Brackett jbrackett

View GitHub Profile
@jbrackett
jbrackett / gist:1044667
Created June 24, 2011 12:20
My win _vimrc file
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
@jbrackett
jbrackett / ServletInitializer.java
Created December 12, 2012 02:11
Basic Servlet initializer for Spring to replace web.xml in Servlet 3 containers (Tomcat 7, Jetty 8, etc.)
import javax.servlet.ServletContext;
import javax.servlet.ServletRegistration;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
public class ServletInitializer implements WebApplicationInitializer {
@Override
@jbrackett
jbrackett / TestAppConfig.java
Created February 9, 2014 13:46
Load in memory database and generate schema from annotated Java files.
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.hibernate.cfg.Environment;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@jbrackett
jbrackett / build.gradle
Created February 10, 2014 01:52
HelloWorldSpring4Build
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "war"
apply plugin: "tomcat"
war { baseName='hello-world' }
sourceCompatibility = 1.7
buildscript {
@jbrackett
jbrackett / AppConfig.java
Last active August 29, 2015 13:56
HelloWorldSpring4Configuration
package com.hello;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(basePackages = { "com.hello.controller", "com.hello.config" })
public class AppConfig {
}
@jbrackett
jbrackett / HelloController.java
Created February 10, 2014 02:22
HelloWorldSpring4Controller
package com.hello.controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/hello")
public class HelloController {
@jbrackett
jbrackett / app.js
Created February 10, 2014 02:30
HelloWorldSpring4View
/*jshint unused: false */
/*global angular:true */
// Declare app level module
var App = angular.module('App', []);
(function() {
'use strict';
App.controller("HelloCtrl", ['$scope', '$http',
function($scope, $http) {
$scope.name = "User";
@jbrackett
jbrackett / HelloControllerTest.java
Last active August 29, 2015 13:56
HelloWorldSpring4Test
package com.hello.controller;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@jbrackett
jbrackett / build.gradle
Created February 10, 2014 22:35
Build file for spring-data-jpa tutorial
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "idea"
sourceCompatibility = 1.7
repositories {
mavenCentral()
}
@jbrackett
jbrackett / AppConfig.java
Created February 10, 2014 22:48
Application configuration for spring-data-jpa tutorial
package com.example;
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.hibernate.cfg.Environment;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;