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
use std::fmt; | |
use ring::digest; | |
use ring::constant_time::verify_slices_are_equal; | |
use rustc_serialize::hex::{ ToHex, FromHex, FromHexError }; | |
use rustc_serialize::base64; | |
use rustc_serialize::base64::{ ToBase64, FromBase64, FromBase64Error }; | |
/// Errors that occur when parsing a hash value | |
pub enum ParseError { |
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
use std::cmp::Ordering; | |
pub struct Ability { | |
mean: f64, | |
variance: f64, | |
} | |
impl Ability { | |
pub fn zero() -> Self { | |
Self::with_stddev(0.0, 0.0) |
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
/*jshint curly:false */ | |
/*global define:true */ | |
define(function() { | |
"use strict"; | |
function Vector2D(x,y) { | |
Object.defineProperties(this, { | |
x: { value: x, enumerable: true }, | |
y: { value: y, enumerable: true }, | |
_length: { writable: true } |
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
package net.deardeuff.ids.ordered; | |
import com.google.common.base.Preconditions; | |
import com.google.common.io.ByteArrayDataOutput; | |
import com.google.common.io.ByteStreams; | |
public final class Ordered64Binary { | |
private static final char TRAILING_CHAR = '.'; | |
private static final Ordered64EncodeMap encoding = | |
new Ordered64EncodeMap("-_").changeDecodingTo(TRAILING_CHAR, (byte)0); |
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
package gaming.online.java; | |
public class Ability { | |
private final double mean; | |
private final double variance; | |
private Ability(final double mean, final double variance) { | |
this.mean = mean; | |
this.variance = variance; | |
} |
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
package gaming.online.scala | |
/** | |
* A representation of a player's ability. A normal distribution, really | |
*/ | |
// private constructor | |
class Ability private (val mean: Double, val stddev: Double, val variance: Double) { | |
// Callers of this method cannot use parentheses | |
def skill:Double = mean - 3 * stddev |
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
(ns gaming.online.ranking | |
"Synopsis: | |
(bradley-terry-full 5 | |
(list (create-team 1 45 (list (create-player 101 (create-ability-with-stddev 25 8)))) | |
(create-team 2 32 (list (create-player 102 (create-ability-with-stddev 25 8)))))) | |
Updates players' ability compared with how they were expected to perform") | |
; defn- means a private function | |
(defn- sum [f xs] |
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
/* | |
Copyright (c) 2010 Morgan Roderick http://roderick.dk | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: |
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
package net.deardeuff.roleobject; | |
import com.google.common.base.Preconditions; | |
/** | |
* A Key based on a Class | |
*/ | |
public final class ClassKey<T> implements View.Key<T> { | |
private final Class<T> delegate; | |
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
// The wait free algorithm is at the very bottom of the page. | |
package performance; | |
import java.util.ArrayDeque; | |
import java.util.Queue; | |
import java.util.concurrent.ConcurrentLinkedQueue; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.LinkedBlockingQueue; |
NewerOlder