Skip to content

Instantly share code, notes, and snippets.

View mrowrpurr's full-sized avatar

Mrowr Purr mrowrpurr

View GitHub Profile
require "date"
require "fileutils"
require "json"
# Make a commit.
# We need the portfiles to refer to an actual commit.
# It will only commit if anything changed, tho.
system "git add ."
system %{git commit -m "Auto commit (content changed) #{DateTime.now.strftime "%d/%m/%Y %H:%M:%S"}"}
@mrowrpurr
mrowrpurr / CMake - Argumen Parser Helper.cmake
Last active December 27, 2022 08:17
CMake - Argumen Parser Helper
# Note: this parser
# Here is the helper macro to use in your project:
macro(parse_arguments)
cmake_parse_arguments(__argument_parser "" "PREFIX" "FLAG;VALUE;MULTI;ARGS" ${ARGN})
if(NOT DEFINED __argument_parser_PREFIX)
set(__argument_parser_PREFIX "${CMAKE_CURRENT_FUNCTION}")
endif()
cmake_parse_arguments("${__argument_parser_PREFIX}" "${__argument_parser_FLAG}" "${__argument_parser_VALUE}" "${__argument_parser_MULTI}" ${__argument_parser_ARGS})
(\[[^\]]*\])\s*(\[[^\]]*\])\s*(\[[^\]]*\])\s*(\[[^\]]*\])\s*(.*)
@mrowrpurr
mrowrpurr / CheckHeaderIncludes.cmake
Last active December 12, 2022 07:54
CMake function which adds a target to check every that header in your project has all required #include's
# CMake function which adds a target to check every that header in your project has all required #include's
function(check_header_includes)
set(options)
set(oneValueArgs TARGET INCLUDE_DIR TEMP_DIR)
set(multiValueArgs HEADERS PACKAGES LIBRARY_PATHS LIBRARIES)
cmake_parse_arguments(CHECK_HEADER_INCLUDES "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT CMAKE_OBJECT_PATH_MAX OR CMAKE_OBJECT_PATH_MAX LESS 1000)
# Bump up the max object path or CMake can get angry with some generated paths
# https://stackoverflow.com/questions/68351713/maximum-path-lengths-with-cmake
@mrowrpurr
mrowrpurr / cpp.json
Last active December 11, 2022 00:23
VS Code User Snippets
{
"Singleton Methods": {
"prefix": "singleton",
"body": [
"$1() = default;\n~$1() = default;\n$1(const $1&) = delete;\n$1($1&&) = delete;\n$1& operator=(const $1&) = delete;\n$1& operator=($1&&) = delete;\nstatic $1& GetSingleton() {\n static $1 singleton;\n return singleton;\n}"
],
"description": "Methods for singleton constructor/descructors incl operators"
}
}
@mrowrpurr
mrowrpurr / .clang-format
Last active December 9, 2022 00:04
Clang for VS Code / C++ on Windows
---
AccessModifierOffset: -4
BasedOnStyle: Google
ColumnLimit: 180
IndentWidth: '4'
NamespaceIndentation: All
TabWidth: '4'
UseTab: Always
IndentPPDirectives: BeforeHash
FixNamespaceComments: false
{
"version": 2,
"cmakeMinimumRequired": { "major": 3, "minor": 21, "patch": 0 },
"configurePresets": [
{
"name": "flags",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/permissive- /Zc:preprocessor /EHsc /MP /W4 -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_WARNINGS"
}
template <class... Types>
void Log(const std::string text, const Types&... args) {
std::string result = std::format(text, args...);
// logger::info("{}", result);
// RE::ConsoleLog::GetSingleton()->Print(std::format("[SkyrimScripting] {}", result).c_str());
// std::cout << result << std::endl;
};
@mrowrpurr
mrowrpurr / .cpp
Created December 1, 2022 17:45 — forked from kzjeef/cpp
async call example of gmock & gtest
#include <iostream>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
using ::testing::_;
using ::testing::AtLeast; // #1
using ::testing::Ge;
using ::testing::NotNull;
using ::testing::StrictMock;