Skip to content

Instantly share code, notes, and snippets.

#include <memory>
template <typename T>
class ValueGetter {
public:
constexpr explicit ValueGetter(const T& value) noexcept : m_value{value} {
}
constexpr const T& get() const {
return m_value;
use crate::chip8::{Chip8, Frame};
use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::sync::atomic::Ordering;
const INITIAL_SCALE: u32 = 8;
const WIDTH: usize = 64;
const HEIGHT: usize = 32;
const TEXTURE_SIZE: usize = WIDTH * HEIGHT * 4;
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <map>
#include <optional>
#include <tuple>
#include <vector>
using s64 = std::int64_t;
using Element = std::pair<s64, std::size_t>;
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <optional>
#include <tuple>
#include <vector>
#include <thread>
#include <map>
#include <iterator>
#include <cstdint>
#include <iostream>
#ifdef _MSC_VER
#include <intrin.h>
#define clz(x) __lzcnt64(x)
#else
#define clz(x) __builtin_clzll(x)
#endif
#include <array>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
constexpr double PI = 3.14159265358979323846;
int main() {
std::array<std::pair<double, double>, 'Z' - 'A' + 1> char_coords{};
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iostream>
// I like rust's primitives better
using u8 = std::uint_fast8_t;
using u16 = std::uint_fast16_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using UnityEngine;
public class InputManager : MonoBehaviour
{
static readonly Vector2 x1 = new Vector2(1f, 0f);
public abstract class InputBase
{
public abstract Vector2 Get();
static public implicit operator Vector2(InputBase inputTypeBase){
return inputTypeBase.Get();
#include <algorithm>
#include <array>
#include <iostream>
#include <string>
#include <type_traits>
constexpr std::array<char, 27> ALPHABET = []() constexpr {
std::remove_const<decltype(ALPHABET)>::type data{};
data[0] = ' ';
for (auto i = 0; i < data.size() - 1; ++i)
#include <cstdint>
#include <iostream>
#include <vector>
#include <set>
#include <iterator>
using u32 = std::uint32_t;
void run(std::istream& stream);