Skip to content

Instantly share code, notes, and snippets.

Sven Efftinge svenefftinge

Block or report user

Report or block svenefftinge

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@svenefftinge
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: https://github.com/dominictarr/rc.git
│ ├─ VendorName: Dominic Tarr
│ └─ VendorUrl: dominictarr.com
├─ (GPL-2.0 OR MIT)
│ └─ ua-parser-js@0.7.18
View Xtext Demo HomeAutomation
// Part 1
org.xtext.homeautomation
// 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
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
@Active(SuperProcessor)
@svenefftinge
svenefftinge / I18Processor.xtend
Created Aug 9, 2013
An annotation processor for localization using Java Resource Bundle
View I18Processor.xtend
@Active(ExternalizedProcessor)
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
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) {
View MrsH.java
import com.google.inject.Inject;
import com.google.inject.Provider;
public class MrsH {
@Inject
private DoorService door;
@Inject
private PanelService panel;
@svenefftinge
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++) {
absoluteResult.add(foo(items.get(j)));
}
You can’t perform that action at this time.