Skip to content

Instantly share code, notes, and snippets.

View kickroot's full-sized avatar

Jason Nichols kickroot

View GitHub Profile
@kickroot
kickroot / gist:5f7751b433684727ce00
Last active August 29, 2015 14:12
Zhi's Coding Challenge
Build a Interpreter and Compiler for Arithmetic Expressions using ANTLR3
Include operators +,-,* and / with usual mathematical precedence, brackets - “(“ and “)”
and constants that are all integers
- Build an ANTLR3 grammar for the expressions
- Generate AST
- Build an interpreter to evaluate expressions
- Add a rule to check for "division by zero"
- Build a compiler to Java bytecode (Bonus)
@kickroot
kickroot / pom.xml
Created April 7, 2014 18:32
Adding headlines to your project
<dependency>
<groupId>com.sourceclear.headlines</groupId>
<artifactId>complete</artifactId>
<version>0.1.6</version>
</dependency>
<dependency>
<groupId>com.sourceclear.headlines</groupId>
<artifactId>complete</artifactId>
<version>0.1.4</version>
</dependency>
@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();
@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 / Java Interface Template
Last active December 14, 2015 08:19
Java Interface template
public interface ${name} {
////////////////////////////////// Methods \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
}
@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 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
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.*
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 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
@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 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\