Skip to content

Instantly share code, notes, and snippets.

View AustinBrunkhorst's full-sized avatar
💭
I may be slow to respond.

Austin Brunkhorst AustinBrunkhorst

💭
I may be slow to respond.
View GitHub Profile
@AustinBrunkhorst
AustinBrunkhorst / snooz_controller.py
Created April 23, 2021 21:47
SNOOZ Command Line Controller
import asyncio
import logging
from datetime import datetime
from threading import RLock
import bluepy.btle
# uuid of the service that controls snooz
SNOOZ_SERVICE_UUID = "729f0608496a47fea1243a62aaa3fbc0"
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_annotation_attribute.cpp
Created March 25, 2018 00:08
C++ Reflection | Compiler Annotation Attribute
__attribute__(( annotate( "Hey look at this annotation!" ) ))
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_attribute_macro.h
Created March 25, 2018 00:07
C++ Reflection | Attribute Macro
#if defined(__REFLECTION_PARSER__)
# define Meta(...) __attribute__((annotate(#__VA_ARGS__)))
#else
# define Meta(...)
#endif
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_attribute_sample.cpp
Created March 25, 2018 00:06
C++ Reflection | Attribute Sample
struct Mashed : public MetaProperty { };
Meta(Mashed)
int potatoes;
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_wrapper_example.cpp
Created March 25, 2018 00:04
C++ Reflection | Function Wrapper Example
int foo(int a, float b, double c)
{
return 0;
}
auto fooWrapper = [](int a, float b, double c)
{
return foo( a, b, c );
};
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_lambda_wrapper.cpp
Created March 25, 2018 00:03
C++ Reflection | Lambda Wrapper
class DemoClass
{
public:
int someMethod(int a)
{
return a;
}
};
auto someMethodWrapper = [](Variant &obj, ArgumentList &args)
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_function_example.cpp
Created March 25, 2018 00:02
C++ Reflection | Functions
struct SoundEffect
{
float volume;
void Load(const std::string &filename);
};
int main(void)
{
Type soundEffectType = typeof( SoundEffect );
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_attribute_example.cpp
Created March 25, 2018 00:01
C++ Reflection | Attribute Example
enum class SliderType
{
Horizontal,
Vertical
};
struct Slider : public MetaProperty
{
SliderType type;
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_complete_example.cpp
Created March 25, 2018 00:00
C++ Reflection | Complete Example
struct SoundEffect
{
Meta(Range(0.0f, 100.0f))
float volume;
};
int main(void)
{
// you can also use type meta::Type::Get( "SoundEffect" ) based on a string name
Type soundEffectType = typeof( SoundEffect );
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_prebuild_example.cmake
Created March 24, 2018 23:57
C++ Reflection | CMake Prebuild Example
set(PROJECT_NAME "Example")
# assume this contains header files for this project
set(PROJECT_HEADER_FILES ...)
# assume this contains source files for this project
set(PROJECT_SOURCE_FILES ...)
# generated file names, in the build directory
set(META_GENERATED_HEADER "${CMAKE_CURRENT_BINARY_DIR}/Meta.Generated.h")