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
let inline isPhom x y z = | |
let sx, sy, sz = x%13,y%13,z%13 | |
if sx = sy && sy = sz then true | |
else | |
let tx, ty, tz = x/13, y/13, z/13 | |
if tx = ty && ty = tz then | |
let a = max sx sy |> max sz | |
let c = min sx sy |> min sz | |
let b = (sx + sy + sz)/3 | |
a = b + 1 && a = c + 2 |
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 class UChecker:IDisposable | |
{ | |
public int[,] CardSet; | |
public int[,] PhomMark; | |
private int _countNotPickedCard; | |
private int _countCardNotInPhom; | |
public int CountCardNotInPhom { get { return _countCardNotInPhom;} set{ _countCardNotInPhom = value;}} | |
private int _countEatenCardInHand; |
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 class Point | |
{ | |
public double X; | |
public double Y; | |
public double Z; | |
} |
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
// inspired by stylus: http://learnboost.github.com/stylus/ | |
// constant | |
transparent = 0.8 | |
fonts = Segoe UI, Arial | |
// function | |
border-radius() | |
-moz-border-radius arguments | |
-webkit-border-radius arguments |
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
// inspired by python, razor | |
ul | |
@foreach (var item in menus) | |
li | |
a [href='@item.Link'] | |
@item.Text | |
p | |
Sum: @x + @y = @(x + y) |
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
int Sum(int[] list) | |
<- 0 += x in list | |
int Max(int[] list) | |
<- max = x | |
if x > max | |
x in list | |
max = int.MinValue | |
QSort(int[] list, int lo, int hi) |
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
ITemplate Compile (string path, string id, string input, List<string> usings) | |
<- assembly.CreateInstance (typeName) | |
typeName = "Templates_Template_{0}_{1}".FormatWith (id, DateTime.Now.Ticks) | |
assembly = results.CompiledAssembly | |
results = provider.CompileAssemblyFromSource (options, code) | |
provider = new CSharpProvider | |
<- new Dictionary<string, string> | |
<- {"CompilerVersion", "v4.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
ITemplate Compile(string assemblyPath, string templateId, string input, List<string> usings) | |
{ | |
var providerOptions = new Dictionary<string, string>(); | |
providerOptions.Add("CompilerVersion", "v4.0"); | |
ITemplate _template = null; | |
var usingBuilder = new StringBuilder(); | |
foreach (var @using in _usings) | |
{ |
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 Slice Get(Slice key, int transactionId = -1) | |
{ | |
var record = UseTransaction (transactionId, tr=>tr.Records.FindLast (r=> r.Key == key)); | |
if (record != null) return record.Value; | |
var r = log.Get(key); | |
if (v != null) return v; | |
return InternalGet(key); | |
} |
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
open System | |
open System.Linq | |
open System.Collections.Generic | |
open System.Collections.Concurrent | |
open Microsoft.FSharp.Collections | |
open System.Reflection | |
type Container() = | |
let _map = new HashMultiMap<Type,Type>(HashIdentity.Structural) | |
let _activated = new ConcurrentDictionary<Type, obj>() |
OlderNewer