Skip to content

Instantly share code, notes, and snippets.

View galak-fyyar's full-sized avatar
🍊

Anatoliy Sokolenko galak-fyyar

🍊
View GitHub Profile
@galak-fyyar
galak-fyyar / pom.xml
Created October 19, 2011 09:25
Generating XML Shema from POJO using Maven
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
@galak-fyyar
galak-fyyar / ForBug.java
Created October 13, 2011 18:59
Weird bug in Java(TM) SE Runtime Environment (build 1.6.0_27-b07) Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
import java.util.*;
class ForBug {
public static void main( String[] a ) {
int m = Integer.MAX_VALUE;
for ( int n = 1; n <= m; n++ ) {
System.out.println( "Step " + n );
}
}
@galak-fyyar
galak-fyyar / CrashThread.java
Created October 13, 2011 14:15
Crash test for JVM that creates unlimited number of threads
import java.util.*;
import java.text.*;
class CrashThread extends Thread {
public static final long BYTES_IN_MEGABYTE = 1024 * 1024;
public static void main(String[] a) throws Throwable {
try {
System.out.println("Maximum possible heap size is " + Runtime.getRuntime().max Memory() / BYTES_IN_MEGABYTE);
@galak-fyyar
galak-fyyar / ChallengeLoader.as
Created October 12, 2011 10:25
Implementing support of curry operation in Flex
public class ChallengeLoader extends EventDispatcher {
public function loadWordSound( wordSoundUrl:String, onSuccess:Function,
onError:Function ):void {
var loadingProcessData:LoadingProcessData = new LoadingProcessData( onSuccess,
onError );
var loadingEventProcessor:Function = FunctionUtils.curry(
onCompleteResourceLoad, loadingProcessData );
var wordSound:Sound = new Sound();