Skip to content

Instantly share code, notes, and snippets.

View 166MMX's full-sized avatar

Johannes Harth 166MMX

View GitHub Profile
package com.initvoid.jlocate
import java.nio.file.FileStore
import java.nio.file.Files
import java.nio.file.LinkOption
import java.nio.file.Path
import java.util.regex.Pattern
class WindowsVolume
{
package com.initvoid.org.eclipse.persistence.logging
import org.eclipse.persistence.logging.AbstractSessionLog
import org.eclipse.persistence.logging.SessionLogEntry
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.slf4j.MDC
public class Slf4jSessionLogger extends AbstractSessionLog
{
@166MMX
166MMX / antlr3.gradle
Last active August 29, 2015 14:04
Quick and dirty Antlr3 gradle tasks till gradle supports Antlr3 (not so proud about the distribution solution)
//USAGE: apply from: 'antlr3.gradle'
configurations {
antlr
}
dependencies {
antlr 'org.antlr:antlr:3.5.2'
compile 'org.antlr:antlr-runtime:3.5.2'
}
@166MMX
166MMX / LkcExpr.g
Created July 28, 2014 20:59
LkcExpr Grammer
grammar LkcExpr;
options {
language=Java;
}
tokens {
T_OR = '||' ;
T_AND = '&&' ;
T_EQUAL = '=' ;
package com.initvoid.jconfig
import groovy.transform.CompileStatic
import java.util.regex.Pattern
@CompileStatic
class PreProcessor
{
static Pattern HELP_PATTERN = ~/^\s*(---)?\s*help\s*(---)?/
grammar zconf;
options {
language=Java;
}
tokens {
T_OR = '||' ;
T_AND = '&&' ;
T_EQUAL = '=' ;
@166MMX
166MMX / ZConfHelpLexer.g
Last active August 29, 2015 14:05
ArrayIndexOutOfBoundsException with imported Lexers https://github.com/antlr/antlr3/issues/161
lexer grammar ZConfHelpLexer;
options {
language=Java;
}
@lexer::header {package com.initvoid.jconfig.zconf;}
//input : lines EOF ;
//
lexer grammar ZConfHelpLexer;
options {
language=Java;
}
@lexer::header {package com.initvoid.jconfig.zconf;}
//input : lines EOF ;
package com.initvoid.antlr3
import groovy.transform.CompileStatic
import org.antlr.runtime.Token
import org.antlr.runtime.TokenSource
@CompileStatic
class LazyFilterTokenStream extends LazyTokenStream {
protected int channel = Token.DEFAULT_CHANNEL
//Invite all you friends in facebook :)
for(var a=document.getElementsByClassName('checkableListItem'), i=a.length-1;i>=0;i--) a[i].click();