Skip to content

Instantly share code, notes, and snippets.

uses gw.api.util.Math
var resultTimesVariable = new long[100]
var resultTimesConcat = new long[100]
for (var count in 0..99) {
var startDate = (new Date()).Time
for (var i in 0..1000000) {
var elem1 = Math.random(10000)
var result = "bla ${elem1}"
@l-ray
l-ray / gist:570a34e3dadd5517f09c
Created October 13, 2015 07:57
Show author-date and commit date with GIT
git log --pretty=fuller
@l-ray
l-ray / gist:724ee7bf3a7faaa33603
Last active February 27, 2018 10:32
Find all properties of an gosu entity
uses gw.lang.reflect.IPropertyInfo
var propertyList = entity.Entity.TypeInfo.Properties.toArray()
propertyList = propertyList.sort( \ elt1, elt2 -> elt1.toString() < elt2.toString())
propertyList = propertyList.where( \ elt -> elt.toString().matches(".*[a-z]+.*"))
propertyList = propertyList.where( \ elt -> not ((elt as IPropertyInfo).Hidden or (elt as IPropertyInfo).Internal))
print("Found entity properties ("+propertyList.Count+"):")
for(myProperty in propertyList) {
@l-ray
l-ray / gist:e58527fc5e740d93bce3
Last active August 29, 2015 14:22
How to debug an ant task
set ANT_OPTS=-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y
// ==UserScript==
// @name Automatic Login
// @namespace browser
// @include http://localhost:8080/url*
// @version 2
// ==/UserScript==
document.getElementById('username').value="login";
document.getElementById('password').value="password";
document.getElementById('loginButton').click();
@l-ray
l-ray / ModuloTenRecursive.gs
Created October 15, 2014 13:50
Modulo10 Rekursiv in Gosu
uses java.lang.Character
uses java.lang.Integer
uses java.util.ArrayList
class ModuloTenRecursiveProcessor {
/**
* Validate a number string using Modulo10 rekursiv
*/
public static function checkSum(numberString:String):int {
@l-ray
l-ray / ModuloTenProcessor.gs
Last active December 25, 2016 20:42
Modulo10 / Mod10 / Luhn algorithm in Gosu
uses java.lang.Integer
uses java.util.Arrays
uses java.lang.Character
uses java.util.ArrayList
class ModuloTenProcessor {
/**
* Validate a number string using Luhn algorithm
*/
package de.lray.intercom.pattern;
public interface Strategy {
void execute(Integer number);
Integer[] getResult();
}
package de.lray.intercom.highscore;
import de.lray.intercom.pattern.Strategy;
import org.junit.Before;
import org.junit.Test;
import java.util.*;
import static org.junit.Assert.assertArrayEquals;
package de.lray.intercom.highscore;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* Runner class for command line calls.
*
* Extracts the given parameter, transforms them to the sub components and shows the result.
*/