Skip to content

Instantly share code, notes, and snippets.

View johnb003's full-sized avatar

John Butterfield johnb003

View GitHub Profile
@johnb003
johnb003 / CMakeLists.txt
Last active April 13, 2024 09:03 — forked from ClintLiddick/External_GTest.cmake
CMake ExternalProject_Add for Google Mock (gmock) and Google Test (gtest) Libraries With Includes and Example Usage
# 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.
include(External_GTest.cmake)
@johnb003
johnb003 / strip_xcode.py
Created February 13, 2018 19:06
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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@johnb003
johnb003 / adaptable.cpp
Last active October 9, 2019 20:29
Adaptable Components in C++
#include <vector>
#include <typeinfo>
#include <typeindex>
#include <unordered_map>
#include <iostream>
class Adaptable;
class AdaptableComponent {
Adaptable *container;
friend Adaptable;
@johnb003
johnb003 / signals.h
Last active October 14, 2019 05:02
Very lightweight Signals / Slots mechanism for C++, with assumed return void. (No need to aggregate).
#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;