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
class PropExtension extends Closure { | |
final map = [:] | |
PropExtension() { | |
super(null) | |
} | |
def methodMissing(String name, args) { | |
map[name] = args[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
#if defined(MASTERSYSTEM) | |
#define COL_DEPTH_BITS 2 | |
#else | |
#define COL_DEPTH_BITS 4 | |
#endif | |
#define COL_PER_PALETTE 16 | |
#define R_MASK ((1<<COL_DEPTH_BITS)-1) | |
#define G_MASK (R_MASK << COL_DEPTH_BITS) |
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
void Main() | |
{ | |
GetItems(MathOperation.Average).Dump(); | |
GetItems(MathOperation.Max).Dump(); | |
GetItems(MathOperation.Min).Dump(); | |
} | |
IEnumerable<Item> GetItems(MathOperation mathOperation) | |
{ | |
Expression<Func<IGrouping<long, Album>, decimal>> operation = mathOperation switch |
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
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22621 | |
12th Gen Intel Core i7-12700H, 1 CPU, 20 logical and 14 physical cores | |
[Host] : .NET Framework 4.8 (4.8.9167.0), X86 LegacyJIT | |
DefaultJob : .NET Framework 4.8 (4.8.9167.0), X86 LegacyJIT | |
| Method | Mean | Error | StdDev | Gen 0 | Allocated | | |
| | |
----------------------------------- |-----------:|----------:|----------:|-------:|----------:| | |
| CantonWithValueTuple | 777.0 ns | 5.18 ns | 4.84 ns | - | - | | |
| CantonAccelerationsClass | 551.9 ns | 10.18 ns | 9.52 ns | 0.3815 | 2,003 B | |
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
void Main() | |
{ | |
var summary = BenchmarkRunner.Run<Test>(); | |
} | |
public class Test | |
{ | |
[Benchmark] | |
public void Max() | |
{ |
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
static class Ext | |
{ | |
public static TAccumulate AggregateUntil<TSource, TAccumulate>(this IEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, (bool, TAccumulate)> func) | |
{ | |
foreach(var item in source) | |
{ | |
var res = func(seed, item); | |
seed = res.Item2; | |
if(res.Item1) | |
break; |
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 MIT License (MIT) | |
* | |
* Copyright (c) 2023 Selvin | |
* | |
*/ | |
#include "ch32v20x.h" //include your board | |
#include "tusb.h" | |
#include <stdbool.h> |
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
/********************************** (C) COPYRIGHT ******************************* | |
* File Name : ch32v20x_usb.h | |
* Author : WCH | |
* Version : V1.0.0 | |
* Date : 2021/06/06 | |
* Description : CH32V20x Device Peripheral Access Layer System Header File. | |
********************************************************************************* | |
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. | |
* Attention: This software (modified or not) and binary are used for | |
* microcontroller manufactured by Nanjing Qinheng Microelectronics. |
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
#include "ch58x_common.h" | |
#include "common/tusb_common.h" | |
#include "common/tusb_types.h" | |
#include "common/tusb_debug.h" | |
#include "hcd.h" | |
#include <assert.h> | |
#define ch58x_info(...) TU_LOG(2, __VA_ARGS__) | |
#define ch58x_trace(...) TU_LOG(3, __VA_ARGS__) |
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
<?xml version="1.0"?> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="DisplayMessages"> | |
<ItemGroup> | |
<MavenArtifact Include="commons-compress-1.23.0" Group="org.apache.commons" Artifact="commons-compress" Version="1.23.0" /> | |
<MavenArtifact Include="commons-compress-1.22" Group="org.apache.commons" Artifact="commons-compress" Version="1.22" /> | |
</ItemGroup> | |
<Target Name="DownloadArtifacts" BeforeTargets="UnzipArchive"> | |
<DownloadFile | |
SourceUrl="https://repo1.maven.org/maven2/$([MSBuild]::ValueOrDefault('%(MavenArtifact.Group)', '').Replace('.', '/'))/$([MSBuild]::ValueOrDefault('%(MavenArtifact.Artifact)', '').Replace('.', '/'))/%(MavenArtifact.Version)/%(MavenArtifact.Artifact)-%(MavenArtifact.Version).jar" |
NewerOlder