This file contains hidden or 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
[MediumRunJob] | |
[MemoryDiagnoser] | |
public class StringDictBench | |
{ | |
System.Collections.Generic.Dictionary<ReadOnlyMemory<char>, string> mem = new(); | |
System.Collections.Generic.Dictionary<string, string> str = new(); | |
string key = "key"; | |
public StringDictBench() | |
{ |
This file contains hidden or 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
[MediumRunJob] | |
[MemoryDiagnoser] | |
public class ToTest | |
{ | |
Dictionary<string,IntPtr> stringKeys = new(); | |
Dictionary<TileKey,IntPtr> structKeys = new(); | |
public ToTest() | |
{ | |
for (int x = -4; x < 5; x++) |
This file contains hidden or 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
private static void ReplaceCrs84WithEpsg4326(object sender, HttpRequestMessage e) | |
{ | |
string rawQuery = e.RequestUri.Query; | |
// Skip requests without a query | |
if (string.IsNullOrEmpty(rawQuery)) | |
return; | |
// For convenience, parse query as a Dictionary | |
var queryParameters = System.Web.HttpUtility.ParseQueryString(rawQuery); |
This file contains hidden or 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
// Redirects requests to a given file | |
class FileBasedHttpResponder : HttpClientHandler | |
{ | |
private readonly FileInfo _targetFileInfo; | |
public FileBasedHttpResponder(string targetPath) | |
{ | |
_targetFileInfo = new FileInfo(targetPath); | |
} |
This file contains hidden or 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
var op = new SphereDrawOperation(player); | |
op.Brush = new NormalBrush(new Block[]{ fillBlockHere }); | |
op.Prepare(marksArrayHere); | |
op.Begin(); |
This file contains hidden or 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 2013 Matvei Stefarov <[email protected]> | |
using System; | |
using JetBrains.Annotations; | |
using RgbColor = System.Drawing.Color; | |
namespace fCraft.Drawing { | |
/// <summary> Represents a palette of Minecraft blocks, | |
/// that allows matching RGB colors to their closest block equivalents. </summary> | |
public class BlockPalette { |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<fCraftAutoRank> | |
<!-- Each <Criterion> tag is a rule. Either short or fully-qualified rank names can be used. | |
This example automatically promotes players from builder to veteran rank if | |
they meet either of the two condition sets. --> | |
<Criterion fromRank="builder#mTaSFlmnBk1QYVqN" toRank="veteran#yuSfyiJ7AvuE0nc8"> | |
<!-- Tags like <OR>, <AND>, <NOR>, and <NAND> logically combine conditions. | |
In this example, two alternative sets of conditions are grouped with <AND>. | |
These groups are then combined by <OR>, which will trigger the promotion | |
if either of the condition sets is met. --> |
This file contains hidden or 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 void takeVote() | |
{ | |
World[] voteWorlds = PropHuntWorlds.OrderBy(x => randWorld.Next()) | |
.Take(3) | |
.ToArray(); | |
NewVote(); | |
Server.Players.Message("&S--------------------------------------------------------------"); | |
Server.Players.Message("Vote for the next map!"); | |
Server.Players.Message("&S/Vote &c1&S for {0}&S, &c2&S for {1}&S, and &c3&S for {2}", |
This file contains hidden or 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
// step 1: find index of largest value | |
// If there is a tie, the last of the tied worlds will be chosen | |
World chosenWorld; | |
int maxVotes = int.MinValue, i = 0; | |
foreach (int votes in voteList) { | |
if ((chosenWorld == null) || (votes > maxVotes)) { | |
maxVotes = votes; | |
chosenWorld = worldList[i]; | |
} | |
i++; |
This file contains hidden or 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 void main(String[] args) { //1. main method. In the main program declare a Scanner variable that is hooked up to System.in. | |
//You need to include the line of code import java.util.Scanner; at the top of your program. Pass the Scanner object you create as a | |
//parameter to any methods that need it. | |
//The main method should not have a lot of statements, instead it shall call other methods. | |
RockPaperScissors(); | |
} | |
public static void RockPaperScissors() { | |
System.out.println("Welcome to Rock Paper Scissors. I, Computer, will be your opponent."); | |
NewerOlder