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.IO; | |
using System.IO.Compression; | |
using System.Text; | |
// read json | |
var file = @"somedata.json"; | |
using var inStream = File.OpenRead(file); | |
// compress |
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 class TaskExtensions | |
{ | |
public static object GetResult(this Task task) | |
{ | |
task.Wait(); | |
var taskType = task.GetType(); | |
var resultProperty = taskType.GetProperty("Result"); | |
return resultProperty?.GetValue(task); | |
} | |
} |
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.Threading.Tasks; | |
public interface IState | |
{ | |
Task RunAsync(); | |
} | |
public class StateMachine | |
{ |
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.Threading; | |
using System.Threading.Tasks; | |
namespace BroadcastEventSample | |
{ | |
public class EventBroadcastTask | |
{ | |
private readonly CancellationTokenSource cancelSource = new CancellationTokenSource(); | |
private readonly TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(); |
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
struct foo | |
{ | |
template<typename... Args> | |
void operator[](Args&&...) | |
{ | |
} | |
}; | |
struct bit {}; | |
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
[Setup] | |
[Run] | |
; add the Parameters, WorkingDir and StatusMsg as you wish, just keep here | |
; the conditional installation Check | |
Filename: "{tmp}\vcredist_x86.exe"; Check: VCRedistNeedsInstall | |
[Code] | |
#ifdef UNICODE | |
#DEFINE AW "W" |
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++ style comments | |
// | |
name "Test model" // key-value pair (kvp) | |
version 1.0 // kvp as number | |
rev 3182 // ... | |
full_screen true // boolean value - can not use 'true'/ 'false as kvp key | |
resizable false |
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 <stdio.h> | |
#include <string> | |
std::string printy(const std::string& p) | |
{ | |
return std::move(p); | |
} | |
template<typename ... Types> | |
std::string printy(const std::string& p, float first, Types ... rest) |
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
#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" ) | |
int main(int, const char**) | |
{ | |
// create window normally | |
return 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
// main.cpp | |
// | |
#include <windows.h> | |
#include <windowsx.h> | |
#include <d3d11.h> | |
#include <d3d11_2.h> | |
#include <algorithm> |
NewerOlder