Skip to content

Instantly share code, notes, and snippets.

View bitshifter's full-sized avatar

Cameron Hart bitshifter

View GitHub Profile
@repi
repi / crate-health.md
Last active February 22, 2024 01:17
Guidelines on evaluating health & quality of third-party crates at Embark

What to evaluate and consider before adding usage of new third-party crates.

These are not exact requirements but questions to investigate and discuss to help reason around the health, safety, maintainability, and more around crates.

This can also be read as an opinionated guide for crate authors of what our (Embark's) guidelines and recommendations are, though should not be taken too literally.

Legend: 🔒 Must have, ⭐️ Should have, 👍 Nice to have, ℹ️ Info

@jakobhellermann
jakobhellermann / update-bevy-0.5.sh
Last active March 23, 2021 15:10
Does the easily automatable part of updating bevy 0.5
#!/bin/bash
if [[ $(git diff --stat) != '' ]]; then
echo 'git has uncommit changes, please commit as this tool can break stuff'
exit
fi
echo "warning: this code isn't very well tested"
read -p "Press enter to continue: "
@bkaradzic
bkaradzic / orthodoxc++.md
Last active July 19, 2024 23:17
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@ocornut
ocornut / printf_tips.cpp
Last active March 24, 2023 11:23
C/C++ tips for using printf-style functions
// C/C++ tips for using printf-style functions
// Lots of manipulation can be expressed simply and fast with printf-style formatting
// Also helps reducing the number of temporaries, memory allocations or copies
// ( If you are looking for a simple C++ string class that is printf-friendly and not heap-abusive,
// I've been using this one: https://github.com/ocornut/Str )
// If you are interested in a FASTER implementation of sprintf functions, see stb_sprintf.h
// https://github.com/nothings/stb/blob/master/stb_sprintf.h
// How to concatenate non-zero terminated strings
@rygorous
rygorous / gl_leak_check.c
Last active August 29, 2015 13:57
DYI GL object leak checker.
static void check_for_leaks()
{
GLuint max_id = 10000; // better idea would be to keep track of assigned names.
GLuint id;
// if brute force doesn't work, you're not applying it hard enough
for ( id = 1 ; id <= max_id ; id++ )
{
#define CHECK( type ) if ( glIs##type( id ) ) fprintf( stderr, "GLX: leaked " #type " handle 0x%x\n", (unsigned int) id )
CHECK( Texture );
@deplinenoise
deplinenoise / typesafe_varargs
Last active July 13, 2022 00:29
You can pass along an array of info with varargs using C++ variadic templates. It generates really tight code; the only remaining overhead at runtime is the static arrays of type information (they end up in the `.rodata` segment). In this example I'm passing in an integer describing each arg, but you could just as well pass in function pointers …
// Type-safe varargs with C++11 variadic templates.
//
// Andreas Fredriksson <deplinenoise at gmail dott com>
//
// This code is in the public domain.
#include <stdio.h>
#include <stdarg.h>