Skip to content

Instantly share code, notes, and snippets.

@talios
talios / gist:2893027
Created June 8, 2012 02:07
Javac Compiler Bug...
Potential bug in JavaC. Surely the line should be:
annotationProcessingOccurred = c.annotationProcessingOccurred == true;
and do a comparison instead of multi-assignment ( and only assign it if annotationProcessingOccurred is current false, as I don't think we want to reassign a true setting to false here).
Open JDK 6:
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/com/sun/tools/javac/main/JavaCompiler.java#JavaCompiler
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000010d97aff8, pid=20796, tid=4591443968
#
# JRE version: 7.0_04-b21
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.0-b21 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# V [libjvm.dylib+0x17aff8]
#
@talios
talios / gist:1892209
Created February 23, 2012 10:44
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@talios
talios / KotlinRootRoute.java
Created February 19, 2012 01:41
Decompilation of Kotlin Class
package com.talios.routes;
import com.google.inject.Inject;
import com.theoryinpractise.halbuilder.ResourceFactory;
import com.theoryinpractise.halbuilder.spi.Resource;
import jet.JetObject;
import jet.TypeInfo;
import jet.runtime.typeinfo.JetClass;
import jet.runtime.typeinfo.JetConstructor;
import jet.runtime.typeinfo.JetMethod;
@talios
talios / TestXtendApp.java
Created February 10, 2012 10:26
Xtend HAL test
package com.talios;
import com.google.common.base.Optional;
import com.talios.App;
import com.theoryinpractise.halbuilder.ResourceFactory;
import com.theoryinpractise.halbuilder.spi.Link;
import com.theoryinpractise.halbuilder.spi.ReadableResource;
import com.theoryinpractise.halbuilder.spi.RenderableResource;
import com.theoryinpractise.halbuilder.spi.Resource;
import java.util.List;
@talios
talios / haltest.clj
Created January 31, 2012 10:48
The first clojure based Halbuilder IT test.
(ns haltest
(:use [clojure.test]))
(deftest haltest
(let [resource-factory (com.theoryinpractise.halbuilder.ResourceFactory.)
resource (doto (.newHalResource resource-factory "/foo")
(.withProperty "name" "Mark")
(.withLink "/home" "home"))]
(println (.renderXml (.asRenderableResource resource)))) )
Process: Google Chrome [1553]
Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Identifier: com.google.Chrome
Version: 17.0.932.0 (932.0)
Code Type: X86 (Native)
Parent Process: launchd [219]
Date/Time: 2011-11-11 10:44:44.513 +1300
OS Version: Mac OS X 10.7.2 (11C74)
Report Version: 9
@talios
talios / gist:1119473
Created August 2, 2011 02:29
F-Script based iTunes playlist sort hack
df := NSDateFormatter new.
df setDateFormat: 'yyyy-MM'.
iTunes := SBApplication applicationWithBundleIdentifier:'com.apple.iTunes'.
playlists := (iTunes sources at: 0) playlists.
playlist := (playlists where: playlists name = 'The Full Daily Play') top.
playlist tracks do: [:track |
skipDate := (NSDate dateWithString: (df stringFromDate: track dateAdded) ++ '-01 00:00:00 +1200').
@talios
talios / gist:1064186
Created July 5, 2011 03:00
Extracting generic class information from generified classes
private ParameterizedType findParameterizedClass(Class clazz) {
if (clazz.getGenericSuperclass() != null && clazz.getGenericSuperclass() instanceof ParameterizedType) {
return (ParameterizedType) clazz.getGenericSuperclass();
} else {
if (clazz.getSuperclass() != null) {
return findParameterizedClass(clazz.getSuperclass());
} else {
throw new ClassCastException(clazz.getName() + " is not generic.");
}
}
@talios
talios / gist:1022190
Created June 13, 2011 01:18
Hacking iTunes playlist for funky sorting.
iTunes := SBApplication applicationWithBundleIdentifier:'com.apple.iTunes'
playlists := ((iTunes sources at: 0) playlists.
playlist := (playlists where: playlists name = 'The Full Daily Play').
playlist tracks do: [:track |
track setSkippedDate: (NSDate dateWithString:
(track dateAdded description substringWithRange: (NSValue rangeWithLocation:0 length:8))
++ '01 00:00:00 +1200')