Skip to content

Instantly share code, notes, and snippets.

@michelsalib
michelsalib / trace.ts
Created April 23, 2015 13:27
Typescript @trace annotation
class Dog {
@trace
compute(a: number, b: number): any {
// my dog is a bit slow and weird to compute..
for (var i = 0; i < 1000000000; i++) {
var result = a + b;
}
// .. not even accurate
return 'wouf';
@michelsalib
michelsalib / deprecated.ts
Created April 23, 2015 13:17
Typescript @deprecated annotation
class Dog {
@deprecated('Dogs don\'t roar, they talk.')
roar() {
console.log('RRRRR');
}
@deprecated()
smile() {
console.log('smile');
}
@michelsalib
michelsalib / timestampable.ts
Created April 22, 2015 15:52
Typescript @timestampable annotation
@timestampable
class Dog {
public name: string = 'Paul';
}
function timestampable(func) {
return <any>(function() {
var genericConstructor = () => {};
genericConstructor.prototype = func.prototype;
var instance = new genericConstructor();
@michelsalib
michelsalib / GreenPlanetTestClient.java
Created February 11, 2012 20:50
Green Planet client basic example
package greenplanettestclient;
import greenplanetclient.*;
import java.io.IOException;
import java.util.ArrayList;
import javax.xml.bind.JAXBException;
/**
* @author michel
*/