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
[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 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 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 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 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 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 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."); | |
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 System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using JetBrains.Annotations; | |
namespace fCraft { | |
public class BitMap3D : IEnumerable<Vector3I> { | |
const int BitCoordMask = 31; | |
readonly uint[] store; |
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 System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using JetBrains.Annotations; | |
namespace fCraft { | |
public class BitMap3D : IEnumerable<Vector3I> { | |
const int BitCoordMask = 31; | |
readonly uint[] store; |
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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace BucketSort | |
{ | |
class Program | |
{ |
NewerOlder