Skip to content

Instantly share code, notes, and snippets.


Sven Efftinge svenefftinge

View GitHub Profile
View migrate.js
const fs = require('fs');
const path = require('path');
const ignored = ['.git', 'migrate.js'];
const encoding = 'latin1';
function allFiles(rootPath, action) {
const files = fs.readdirSync(rootPath);
for (const e of files) {
svenefftinge / theia-dep-licenses.txt
Last active Feb 5, 2019
Licenses of theia dependencies. Output of `yarn licenses list`
View theia-dep-licenses.txt
yarn licenses v1.12.3
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
├─ (BSD-2-Clause OR MIT OR Apache-2.0)
│ └─ rc@1.2.8
│ ├─ URL:
│ ├─ VendorName: Dominic Tarr
│ └─ VendorUrl:
├─ (GPL-2.0 OR MIT)
│ └─ ua-parser-js@0.7.18
View Xtext Demo HomeAutomation
// Part 1
// To Be Parsed
Device Window can be OPEN, CLOSED
Device Heating can be ON, OFF
Rule 'Close Window, when heating turned on'
View while.xtend
var char character;
while ((character = buffer.get) != PacketConstants.STRING_TERMINATOR) {
// do stuff
svenefftinge / Super.xtend
Created Aug 29, 2013
An active annotation that declares constructors delegating to super constructors.
View Super.xtend
package superConstr
import org.eclipse.xtend.lib.macro.AbstractClassProcessor
import org.eclipse.xtend.lib.macro.Active
import org.eclipse.xtend.lib.macro.TransformationContext
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration
import org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration
import org.eclipse.xtend.lib.macro.declaration.Visibility
svenefftinge / I18Processor.xtend
Created Aug 9, 2013
An annotation processor for localization using Java Resource Bundle
View I18Processor.xtend
annotation Externalized {}
class ExternalizedProcessor extends AbstractClassProcessor implements CodeGenerationParticipant<ClassDeclaration> {
override doTransform(MutableClassDeclaration annotatedClass, extension TransformationContext context) {
for (field : annotatedClass.declaredFields) {
val initializer = field.initializerAsString
val msgFormat = try {
new MessageFormat(initializer)
svenefftinge / gist:3621045
Created Sep 4, 2012
AST construction with data typed in Xtend
View gist:3621045
package basepack.exmaple2
import java.util.Map
import org.eclipse.xtend.lib.Data
class Eval {
def static void main(String...args) { new Eval().run } // run inside an instance instead of statically so we can operator overloading (and use extensions)
def evaluate(Map<String,Integer> it, Expression exp) {
public class MrsH {
private DoorService door;
private PanelService panel;
svenefftinge / gist:1506285
Created Dec 21, 2011
This one prints : "Took : 31 ms, number of elements : 3000000"
View gist:1506285
public static void main(String[] args) {
int iterations = 1000000;
List<?> items = newArrayList("foo", 23, true);
List<Object> absoluteResult = new ArrayList<Object>(iterations*items.size());
long before = System.currentTimeMillis();
for (int i=0; i < iterations; i++) {
for (int j=0 ; j< items.size(); j++) {
You can’t perform that action at this time.