Skip to content

Instantly share code, notes, and snippets.

@digulla
digulla / Dockerfile.template
Last active December 22, 2015 06:25
Oracle XE 11 Docker image without license issues
FROM ubuntu:14.04.1
MAINTAINER Wei-Ming Wu <wnameless@gmail.com>
ADD chkconfig /sbin/chkconfig
ADD init.ora /
ADD initXETemp.ora /
@PARTS@
RUN cat /@BASENAME@.deb?? > /@BASENAME@.deb
@digulla
digulla / jquery.text-overflow.js
Created June 17, 2013 10:33
Backup of Devon Govett's ellipsis plugin for jQuery
/*
* MIT LICENSE
* Copyright (c) 2009-2011 Devon Govett.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
@digulla
digulla / updateSiteXml.py
Created March 11, 2013 09:49
Small Python script to generate site.xml files for a multi-module build. Run this after every change to the project structure.
#!/usr/bin/env python
from xml.etree.ElementTree import ElementTree, tostring
import os
import sys
import re
template = '''\
<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@digulla
digulla / ApplicationContextAwareTestBase.java
Last active December 12, 2015 12:09
Helper class to reset/clean up Spring beans after a unit test
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.List;
import java.util.Map;
import org.junit.After;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.springframework.aop.TargetClassAware;
@digulla
digulla / config_demo.py
Created October 11, 2012 12:17
Comfortable config access with Python
#!/usr/bin/env python
import ConfigParser
import inspect
class DBConfig:
__doc__ = 'Collect a couple of config options in a type'
def __init__(self):
@digulla
digulla / mvn-deploy.sh
Created October 8, 2012 13:18
Better mvn deploy
#!/bin/bash
if [[ ! -e pom.xml ]]; then
echo "Missing pom.xml" 1>&2
exit 1
fi
sed \
-e '/<distributionManagement>/,/<\/distributionManagement>/d' \
-e '/<\/project/d' \
@digulla
digulla / IntRange.java
Created October 2, 2012 08:33
IntRange for Xtend which works as Java developers expect
/*
Copyright (c) 2012, Aaron Digulla
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
@digulla
digulla / TypeAndImportUriGlobalScopeProvider.java
Created September 21, 2012 11:50
A global scope provider that is both able to process the importURI attributes to establish cross links with other EMF models, and to handle references to JVM types.
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.EcoreUtil2;
import org.eclipse.xtext.common.types.TypesPackage;
import org.eclipse.xtext.common.types.xtext.AbstractTypeScopeProvider;
import org.eclipse.xtext.common.types.xtext.ClasspathBasedTypeScopeProvider;
import org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
@digulla
digulla / FastXtextResourceSetProvider.java
Created September 20, 2012 07:11
Faster implementation of XtextResourceSetProvider.
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IProject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.ui.resource.IResourceSetProvider;
import org.eclipse.xtext.ui.resource.XtextResourceSetProvider;
import org.eclipse.xtext.ui.util.JdtClasspathUriResolver;
@digulla
digulla / XmlModelFactory.java
Created July 27, 2012 16:55
Xml model factory for Wro4j which can reference imports (see https://code.google.com/p/wro4j/issues/detail?id=423)
/*
* Copyright (c) 2008. All rights reserved.
*/
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.commons.lang3.StringUtils;