Skip to content

Instantly share code, notes, and snippets.

View garrettsickles's full-sized avatar
🎯
Focusing

Garrett Frank Sickles garrettsickles

🎯
Focusing
View GitHub Profile
@garrettsickles
garrettsickles / setup_postman.md
Last active September 9, 2022 17:49
Setup client side protobuf library in Postman
  1. Install protobufjs node module
$ npm install protobufjs
  1. Given a protobuf definition, Person.proto
syntax = "proto2";

message Person {
@garrettsickles
garrettsickles / singleton.h
Last active November 11, 2017 22:06
singleton_c++
class Singleton {
public:
// Singleton Pattern
// Instance() returns a single static instance of the Singleton class.
// This singleton is shared between a single compilation unit.
static Singleton& Instance() {
static Singleton singleton;
return singleton;
}
@garrettsickles
garrettsickles / awesomplete_inpage_links.html
Last active August 30, 2017 03:14
Awesomplete In-Page Links by Class Name (HTML, JavaScript)
@garrettsickles
garrettsickles / avx2_optimized_cross_product.h
Last active October 25, 2023 10:36
AVX2 Optimized Cross Product (C, C++)
// --------------------------------------------------------------- //
// Need To Know
// _MSC_VER: Microsoft C/C++ Compiler
// __AVX2__: AVX2 Instruction Set Flag
// __FMA__: Fused Multiply Add Flag
// --------------------------------------------------------------- //
// On Windows, __AVX2__ is defined but __FMA__ so define it
#if defined(_MSC_VER) && defined(__AVX2__) && !defined(__FMA__)
#define __FMA__
@garrettsickles
garrettsickles / cross_platform_console_colorization.h
Last active August 30, 2017 03:02
Cross Platform Console Colorization (C, C++)
// --------------------------------------------------------------- //
// Need To Know
// _MSC_VER: Microsoft C/C++ Compiler
// --------------------------------------------------------------- //
// Microsoft C/C++ Compiler
#if defined (_MSC_VER)
// Console Control
#include <Windows.h>
@garrettsickles
garrettsickles / cross_platform_api.h
Last active August 30, 2017 03:47
Cross Platform API Declaration (C, C++)
// --------------------------------------------------------------- //
// Need To Know
// _MSC_VER: Microsoft C/C++ Compiler
// DLL_EXPORT: Defined when compiling to a DLL (DynamicLibrary)
// STATIC_EXPORT: Defined when compiling to a LIB (StaticLibrary)
// --------------------------------------------------------------- //
// Microsoft C/C++ Compiler (MSVC)
#if defined(_MSC_VER)
#if defined(DLL_EXPORT)