Skip to content

Instantly share code, notes, and snippets.

View kickroot's full-sized avatar

Jason Nichols kickroot

View GitHub Profile
@kickroot
kickroot / CustomSecurityTagLib.groovy
Created November 20, 2012 19:08
This custom Grails taglib is an easy way to allow for Role and ACL based checks in the view
/* Copyright 2009-2012 SpringSource.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@kickroot
kickroot / gist:4204368
Created December 4, 2012 14:17
Github cheat sheet
## Change to your project root folder and do this initially to get your repo set up
git init
git remote add origin <Your repo URL>
git pull origin master
git add .
git commit -am "Initial commit"
git push
## Do this whenever you have changes to make permanent
@kickroot
kickroot / ApiTokenAuthentication.groovy
Created February 13, 2013 20:47
Grails authentication via API key, Authentication implmentation.
package com.mycompany
import org.springframework.security.*
import org.springframework.security.core.*
class ApiTokenAuthentication implements Authentication {
///////////////////////////// Class Attributes \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
////////////////////////////// Class Methods \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
package com.mycompany
import org.springframework.security.*
import org.springframework.security.core.*
import org.springframework.security.authentication.*
import org.springframework.security.core.userdetails.UsernameNotFoundException;
class ApiTokenAuthenticationProvider implements AuthenticationProvider {
///////////////////////////// Class Attributes \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
package com.mycompany
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.security.*
import org.springframework.web.filter.GenericFilterBean;
import org.springframework.beans.factory.*
import org.springframework.context.*
import javax.servlet.*
import javax.servlet.http.*
@kickroot
kickroot / Java Class Template
Created February 28, 2013 14:19
My basic template for Java classes
public class ${name} {
///////////////////////////// Class Attributes \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
////////////////////////////// Class Methods \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//////////////////////////////// Attributes \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
/////////////////////////////// Constructors \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
@kickroot
kickroot / Java Interface Template
Last active December 14, 2015 08:19
Java Interface template
public interface ${name} {
////////////////////////////////// Methods \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
}
@kickroot
kickroot / InterleavedRunnable.java
Created March 11, 2013 15:24
Thread Interleaving example
package interleavedexample;
import java.util.concurrent.Exchanger;
import java.util.logging.Logger;
/**
*
*/
public class InterleavedRunnable implements Runnable {
@kickroot
kickroot / gist:5673054
Last active December 17, 2015 21:09
Getting the selected file from a context menu popup in Eclipse.
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
ISelectionService service = window.getSelectionService();
IStructuredSelection structured = (IStructuredSelection) service.getSelection();
<dependency>
<groupId>com.sourceclear.headlines</groupId>
<artifactId>complete</artifactId>
<version>0.1.4</version>
</dependency>