Skip to content

Instantly share code, notes, and snippets.


John Butterfield johnb003

View GitHub Profile
johnb003 / signals.h
Last active Oct 14, 2019
Very lightweight Signals / Slots mechanism for C++, with assumed return void. (No need to aggregate).
View signals.h
#include <forward_list>
#include <functional>
#include <memory>
template <typename... FuncArgs>
class Signal
using Function = std::function<void(FuncArgs...)>;
std::forward_list<std::weak_ptr<Function> > registeredListeners;
johnb003 / adaptable.cpp
Last active Oct 9, 2019
Adaptable Components in C++
View adaptable.cpp
#include <vector>
#include <typeinfo>
#include <typeindex>
#include <unordered_map>
#include <iostream>
class Adaptable;
class AdaptableComponent {
Adaptable *container;
friend Adaptable;
johnb003 /
Created Feb 13, 2018
Strip sections from an xcode project that aren't supported by cocoapods.
# Copyright (C) 2018 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
johnb003 / CMakeLists.txt
Last active Dec 31, 2021 — forked from ClintLiddick/External_GTest.cmake
CMake ExternalProject_Add for Google Mock (gmock) and Google Test (gtest) Libraries With Includes and Example Usage
View CMakeLists.txt
# Assuming this your tests/CMakeLists.txt (and your libs are setup in a root config)
# Just make sure to include(CTest) in your *root* cmake config.
# 3.9 adds support for "GoogleTest" which enumerates the tests inside
# of the code and adds them to ctest.
cmake_minimum_required(VERSION 3.9)
# Configure google-test as a downloadable library.