Skip to content

Instantly share code, notes, and snippets.

View concubicycle's full-sized avatar

concubicycle concubicycle

  • Digipen Institute Of Technology
  • New York City
View GitHub Profile
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
@concubicycle
concubicycle / gist:f81909d119774b5272dabd3281187f2e
Created February 17, 2019 02:44
HasRegexAttribute. Like RegularExpressionAttribute, but allows multiple.
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)]
public class HasRegexAttribute : ValidationAttribute
{
private string _pattern;
private string _errorMessage;
public HasRegexAttribute(string pattern, string errorMessage)
{
_pattern = pattern;
@concubicycle
concubicycle / add_assimp.cmake
Created September 17, 2019 20:12
Add assimp as external project, build as static lib, only include desired importers (keep lib size down).
include(ExternalProject)
ExternalProject_Add(assimp
PREFIX assimp
GIT_REPOSITORY https://github.com/assimp/assimp.git
GIT_TAG master
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}/assimp
-DBUILD_SHARED_LIBS=OFF
-DASSIMP_BUILD_TESTS=OFF
# -DOpenGL_GL_PREFERENCE=GLVND # on certain systems
@concubicycle
concubicycle / glfw_glue_callback.cpp
Created October 25, 2019 06:46
Attach C++ classes to glfw callbacks, without setting pointers.
// ...
void (*build_framebuffer_callback(rendering::renderer& r))(GLFWwindow*, int, int)
{
static rendering::renderer& renderer = r;
void (*callback)(GLFWwindow*, int, int) = ([](GLFWwindow* window, int width, int height) {
renderer.resize(width, height);
});