Skip to content

Instantly share code, notes, and snippets.

digulla /
Created Sep 1, 2011
Demo for SimpleXml line number problem
package net.sf.simple.test;
import static org.junit.Assert.*;
import org.junit.Test;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
digulla / SDL-1.2.14-x11modes.patch
Created Dec 4, 2011
Patch to force a certain window/screen size in SDL games
View SDL-1.2.14-x11modes.patch
--- SDL-1.2.14/src/video/x11/SDL_x11modes.c 2009-10-13 01:07:15.000000000 +0200
+++ SDL-1.2.14/src/video/x11/SDL_x11modes.c 2011-12-04 12:34:55.000000000 +0100
@@ -33,7 +33,7 @@
#include "SDL_x11modes_c.h"
#include "SDL_x11image_c.h"
-/*#define X11MODES_DEBUG*/
+#define X11MODES_DEBUG
#define MAX(a, b) (a > b ? a : b)
digulla /
Created Mar 22, 2012
Small script to copy the difference between two folders to a new folder
#!/usr/bin/env python
import os
import os.path
import sys
import shutil
# Bugfixed version of makedirs
def makedirs(name, mode=0777):
"""makedirs(path [, mode=0777])
digulla /
Created Apr 10, 2012
Refactored org.cloudsmith.geppetto.pp.dsl.ui.preferences.AbstractRebuildingPreferencePage
* Copyright (c) 2011 Cloudsmith Inc. and other contributors, as listed below.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* Contributors:
* Cloudsmith
* Aaron Digulla
digulla /
Created Jul 27, 2012
Xml model factory for Wro4j which can reference imports (see
* Copyright (c) 2008. All rights reserved.
import java.util.HashMap;
import java.util.Map;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.commons.lang3.StringUtils;
digulla /
Created Sep 20, 2012
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 /
Created Sep 21, 2012
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 /
Created Oct 2, 2012
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 /
Created Oct 8, 2012
Better mvn deploy
if [[ ! -e pom.xml ]]; then
echo "Missing pom.xml" 1>&2
exit 1
sed \
-e '/<distributionManagement>/,/<\/distributionManagement>/d' \
-e '/<\/project/d' \
digulla /
Created Oct 11, 2012
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):