Skip to content

Instantly share code, notes, and snippets.

View sylveon's full-sized avatar

Charles Milette sylveon

View GitHub Profile
struct FilenameHash
{
using transparent_key_equal = FilenameEqual;
std::size_t operator()(std::wstring_view k) const
{
std::size_t hash = Util::INITIAL_HASH_VALUE;
for (std::size_t i = 0; i < k.length(); ++i)
{
if (Util::IsAscii(k[i]))
module;
#include <atomic>
#include <coroutine>
#include <utility>
export module Module;
namespace winrt::impl
{
inline std::pair<int32_t, int32_t> get_apartment_type() noexcept
{
@sylveon
sylveon / main.cpp
Created November 4, 2021 19:46
Win32 Mica
#include <Unknwn.h>
#include <winrt/Windows.System.h>
#include <winrt/Windows.UI.Composition.Desktop.h>
#include <windows.ui.composition.interop.h>
#include <ShellScalingAPI.h>
#include <DispatcherQueue.h>
extern "C" IMAGE_DOS_HEADER __ImageBase;
using namespace winrt;

Keybase proof

I hereby claim:

  • I am sylveon on github.
  • I am sylve0n (https://keybase.io/sylve0n) on keybase.
  • I have a public key whose fingerprint is 5664 9C67 BEBE 739F 8A2E C319 1A5A E813 77AD 973A

To claim this, I am signing this object:

#include <cstddef>
#include <filesystem>
#include <iostream>
#include <memory>
#include <Shlobj.h>
#include <string>
#include <winver.h>
#include <wil/resource.h>
#include "version.hpp"
#pragma once
#include "arch.h"
#include <dwmapi.h>
#include <functional>
#include <string>
#include <windef.h>
#include <winuser.h>
#ifdef _TRANSLUCENTTB_EXE
#include <filesystem>
@sylveon
sylveon / filesystem-string_view-proposal.md
Last active May 28, 2019 20:35
Improving interoperability between std::filesystem::path and std::string_view

Improving interoperability between std::filesystem::path and std::string_view

Document number: D0000R0
Date: 2019-05-28
Project: WG21, Library Working Group
Author: Charles Milette charles.milette@gmail.com

1. Introduction

This proposal allows assigning a type convertible to a std::string_view to a std::filesystem::path.

#include <string>
#include <tuple>
#include <utility>
template<typename T, typename U>
constexpr auto operator ,(T&& a, U&& b)
{
return std::make_tuple(std::forward<T>(a), std::forward<U>(b));
}
@sylveon
sylveon / a.cpp
Last active February 28, 2019 05:06
Roast me
namespace impl {
constexpr bool IsDecimalDigit(wchar_t character)
{
return character >= L'0' && character <= L'9';
}
constexpr bool IsCapitalHexDigit(wchar_t character)
{
return character >= L'A' && character <= L'F';
}
#include <string>
#include <windows.h>
#include "swcadef.h"
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
std::wstring className;
className.resize(257); // According to docs, maximum length of a class name is 256, but it's ambiguous
// wether this includes the null terminator or not.