This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Owin; | |
using Microsoft.Owin.Hosting; | |
using Owin; | |
using System; | |
using System.Net.Http; | |
namespace SelfHost | |
{ | |
public class Program | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
name: "execute", | |
icon: "http://example.com/example.png", | |
homepage: "http://Dykam.nl", | |
author: {name: "Dykam", email: "dev@dykam.nl"}, | |
license: "GPL", | |
description: "Execute javascript.", | |
help: "Enter a javascript snippet.", | |
takes: {"code": /.*/}, | |
preview: function(pblock, code) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdeUtils.CreateCommand({ | |
name: "execute", | |
icon: "http://example.com/example.png", | |
homepage: "http://Dykam.nl", | |
author: {name: "Dykam", email: "dev@dykam.nl"}, | |
license: "GPL", | |
description: "Execute javascript.", | |
help: "Enter a javascript snippet.", | |
takes: {"code": /.*/}, | |
preview: function(pblock, code) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .gitignore for .NET projects | |
# Thanks to Derick Bailey | |
# http://www.lostechies.com/blogs/derickbailey/archive/2009/05/18/a-net-c-developer-s-gitignore-file.aspx | |
# - Alexey Abramov | |
# Thanks to all others | |
# Standard VS.NET and ReSharper Foo | |
obj | |
bin | |
*.csproj.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"from": "nus", | |
"tasks": [ | |
{ "task": "systemmenu", "installIos": false, "version": 4.2, "region": "E" }, | |
{ "task": "ios", "patchEsIdentify": false, "patchFakesign": false, "version": 70, "revision": 6687 }, | |
{ "task": "channel", "name": "News Channel", "region": "J" }, | |
{ "task": "title", "id": "000000010000001C", "revision": 1806, "patchEsIdentify": true, "patchFakesign": true, "patchNand": true, "from": "sd" } | |
] | |
} |
OlderNewer