Skip to content

Instantly share code, notes, and snippets.

<div class="InfoWindow">
<div><span>description</span></div>
<fieldset class="Directions">
<legend>Route</legend>
<div class="Container">
<label>Van</label><input type="text" class="Dest" />
<label>naar</label><span class="Wrapped">address</span><input type="submit" value="Route zoeken" class="Search" />
</div>
</fieldset>
</div>
@Dykam
Dykam / pom.xml
Created December 9, 2013 23:58
Template for debug maven module. Put it in a subfolder of the main maven module, supply the params, and execute mvn install on it.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId><!--groupId--></groupId>
<artifactId><!--artifactId-->Debug</artifactId>
<version><!--version--></version>
<packaging>pom</packaging>
public static final <T> T bestMatch(String search, Collection<T> options, double threshold) {
T bestObj = null;
double bestScore = 0.0D;
for (T obj : options) {
double score = LiquidMetal.score(obj.toString(), search);
if (score > bestScore) {
bestObj = obj;
bestScore = score;
} else if (score == bestScore) {
bestObj = null;
@Dykam
Dykam / Java 6 or 7.java
Last active August 29, 2015 14:06
Event & Threading model proposal (Usege example)
// When using Java 6 or 7
Observable<Vector> positions =
server.events.playerMove().map(new Fn<PlayerMoveEvent, Vector>() {
public Vector call(PlayerMoveEvent event) {
return event.getPlayer().getPosition();
}
})
.async() // continue on threadpool
.map(new Fn<Vector, Vector>() {
public Vector call(Vector vector) {
@Dykam
Dykam / interfaces.java
Last active August 29, 2015 14:06
Message Object Format
interface TextMessage {}
interface RawTextMessage extends TextMessage { String getValue(); }
interface Style extends TextMessage { TextStyle getStyle(); TextMessage getMessage(); }
interface Action extends TextMessage { TextAction getAction(); TextEvent getEvent(); TextMessage getMessage(); }
/* Combines multiple texts */
interface Combined extends TextMessage { List<TextMessage> getMessages(); }
@Dykam
Dykam / README
Last active August 29, 2015 14:06
Event and Threading model proposal
A small non-complete example design and implementation of Observables/Tasks integrated into events.
It is inspired by a mix of classic Observables and .NET's Tasks/SynchronizationContext.
@Dykam
Dykam / Program.cs
Last active August 29, 2015 14:19
Small stand-alone URL-echoing server
using Microsoft.Owin;
using Microsoft.Owin.Hosting;
using Owin;
using System;
using System.Net.Http;
namespace SelfHost
{
public class Program
{
@Dykam
Dykam / update.coffee
Last active August 29, 2015 14:21
Sponge updaters
#!/usr/bin/env node
// Run before first use:
// $ node install request
request = require "request"
fs = require "fs"
repo = "https://repo.spongepowered.org/maven"
console.log "Downloading verison list"
// ==UserScript==
// @name Youtube to Youtube gaming
// @namespace http://dykam.nl/
// @version 0.1
// @description Redirects the YT watch page to the better YT gaming watch page
// @author Dykam
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
@Dykam
Dykam / 0. Musings with C#
Last active December 29, 2015 15:19
Comp# - Experimentations with dialecting C#
Why is it so hard to set a title, GitHub?