Skip to content

Instantly share code, notes, and snippets.

// Created by Thomas Visser on 10/10/2009.
#import "cocos2d.h"
#import "Loadable.h"
@interface GraphicObject : CocosNode <Loadable> {
}
@end
// Created by Thomas Visser on 10/10/2009.
#import "GraphicObject.h"
#import "LoadableDelegate.h"
@implementation GraphicObject
- (void) loadWithDelegate: (id <LoadableDelegate>) delegate {
// called by the Loader created in GameLayer
for( int i = 0; i < 100000000; i++ ) { }
// first read is called, then write
// how to wait without blocking the serial GCD queue 'queue'?
- (void) read {
dispatch_sync(queue, ^{
while( [connectedFiles count] == 0 ) {
// wait here: how?
}
[connectedFiles removeAllObjects];
});
import java.util.Random;
public class ExceptionTest {
private static final int TESTS = 10000000;
public static void main(String[] args) {
Random rand = new Random();
String str = null;
abstract class Super {
public void identify() {
System.out.println(this.getClass());
}
}
class Child extends Super {
}
package com.tot.samples.RadioButtonCellSample;
import com.google.gwt.cell.client.AbstractEditableCell;
import com.google.gwt.cell.client.Cell;
import com.google.gwt.cell.client.ValueUpdater;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.InputElement;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.safehtml.shared.SafeHtml;
public class ShardedCounter implements Serializable {
private static final long serialVersionUID = 1L;
@Transient
private transient ObjectifyFactory of;
@Unindexed
private String name;
private ShardedCounter() {
@Thomvis
Thomvis / gist:997880
Created May 29, 2011 15:50
Example to illustrate a use case of key-creation in GWT
interface HasReferences {
// just an interface,
}
@Entity
public class Person implements HasReferences {
// ...
}
@Entity
@Thomvis
Thomvis / IsTheIPhoneDeveloperCenterDown.java
Created June 6, 2011 19:34
Check whether the iPhone Developer Center is still down after the WWDC '11 announcements.
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.sql.Timestamp;
import java.util.Date;
public class IsTheIPhoneDeveloperCenterDown {
public static void main(String[] args) throws java.lang.InterruptedException {
try {
@Thomvis
Thomvis / gist:1049535
Created June 27, 2011 18:58
Command for downloading large files with resume
curl -b <(sqlite3 -separator $'\t' ~/Library/Application\ Support/Google/Chrome/Default/Cookies "select host_key, 'TRUE','/', 'FALSE', expires_utc, name, value from cookies where host_key like '%apple.com%'") <file_url> -o <output_file_url> -C -