Skip to content

Instantly share code, notes, and snippets.

View LB--'s full-sized avatar

LB--

  • Clickteam
View GitHub Profile
@LB--
LB-- / overload-simple.cpp
Last active March 22, 2018 02:35
I'm working on an implementation of std::overload. This is a simple ugly hacky version that only works with plain functions or +lambdas.
#include <variant>
template<typename R, typename Arg>
using unary_func = R (*)(Arg);
template<typename R, typename... Arg>
struct Callable final
{
std::add_pointer_t<void> const funcs[sizeof...(Arg)];
template<typename GivenArg, std::size_t Index = 0>
static constexpr std::size_t index_of()
@LB--
LB-- / Minecraft-Name-History.php
Last active July 31, 2016 23:23
Minecraft Name History - http://www.LB-Stuff.com/Minecraft-Name-History - really hacky PHP script, available in public domain
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Minecraft Name History - Nicholas "LB" Braden</title>
<link rel="canonical" href="http://www.LB-Stuff.com/Minecraft-Name-History" />
<link rel="stylesheet" href="/light.css" />
<link rel="icon" type="image/png" href="/LB.png" />
<script src="https://apis.google.com/js/platform.js" async defer></script>
</head>
@LB--
LB-- / CONTRIBUTING.md
Last active July 5, 2016 14:48
My personal contributing guidelines

git

  • Read the license! Understand that your contribution will exist under the terms of the license and that as a result you may be giving up ownership of your code!
  • Preserve history! Only rebase or squash as told to do so in this guide. We don't care about the way commit graphs look.
  • Every commit must compile! This helps with bisecting, among other things.
  • When adding a new feature, base your work on the oldest commit that will allow your new code to compile and run as intended. This helps with merging specific features into older versions.
  • When fixing bugs, base the fix on the commit that introduced the bug. This helps with merging in bugfixes into older versions for bugfix releases.
  • When changing behavior, base your work on the most recent commit that changed or introduced the behavior. This helps with reverting changes for specially-made old versions, as well as making it easy to trace all the ways something has changed.
  • When removing code, base your work on the most recent commit that chang
@LB--
LB-- / heart.cpp
Created May 8, 2016 05:19
Mother's Day C++ Heart
#include <cmath>
#include <iostream>
#include <vector>
static constexpr std::double_t PI = std::acos(-1.0);
static constexpr std::size_t SIZE_X = 100;
static constexpr std::size_t SIZE_Y = 50;
static constexpr std::double_t STEP = 0.01;
static constexpr std::double_t MAX = PI*2.0;

There are two common workflows - 'merge based workflow' and 'rebase workflow'.

In the former, you use git merge to merge in changes which creates merge commits (commits with multiple parents). People who like preserving history tend to prefer merge based workflow. I personally like to use git merge --no-ff --no-commit, which allows git to do what it can to automatically make the merge but then lets me inspect the files before concluding the merge - I do this to ensure that every commit compiles. There are cases where git can automatically merge two compiling commits into one that doesn't compile (e.g. one branch removed an unused variable and the other branch added code that uses that variable - no conflict because different lines were changed, and each branch compiles, but the automatic merge does not compile).

The latter workflow is typically used by people who like a clean commit graph. Generally this is because they use tools that visually represent the commit graph to them and merge-based workflows

Test project C:/Users/LB/Code/Magnum/build/Magnum-prefix/src/Magnum-build
Start 1: MathAlgorithmsGaussJordanTest
1/131 Test #1: MathAlgorithmsGaussJordanTest ......... Passed 0.02 sec
Start 2: MathAlgorithmsGramSchmidtTest
2/131 Test #2: MathAlgorithmsGramSchmidtTest ......... Passed 0.02 sec
Start 3: MathAlgorithmsSvdTest
3/131 Test #3: MathAlgorithmsSvdTest ................. Passed 0.02 sec
Start 4: MathGeometryDistanceTest
4/131 Test #4: MathGeometryDistanceTest .............. Passed 0.02 sec
Start 5: MathGeometryIntersectionTest
@LB--
LB-- / rebuild.bat
Last active January 1, 2016 17:39
rebuild.bat - Windows build script for ChessPlusPlus
del /s /f /q .\build\* && for /f %%f in ('dir /ad /b .\build\ ') do rd /s /q .\build\%f
title ChessPlusPlus-Build && mkdir build
cd build && cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_FLAGS="-DCHESSPP_TRUNC_LOGS=1 -Wall -Wextra -pedantic -Winit-self -Wredundant-decls -Wcast-align -Wfloat-equal -Wunreachable-code -Wmissing-include-dirs -Wmain -Werror -Wfatal-errors -Wno-unused-parameter -Wno-unused-local-typedefs" -DSTATIC_BUILD=1 -DBOOST_ROOT=C:/MinGW -DSFML_ROOT=C:/MinGW ../
cmd /k "make"
@LB--
LB-- / settings.json
Created December 1, 2013 23:53
New Bukkit Plugin idea
{
"/hugall":
{
"by": "You hug everyone",
"all": "%0 hugs you and everyone else"
},
"/hug *":
{
"by": "You hug %*",
"*": "%0 hugs you"
@LB--
LB-- / hSDK Planning 1.cpp
Created November 16, 2013 22:20
Just some code snippets I used for planning while I only had access to a computer that was not mine and had no internet access.
//fix for void returns
template<>
struct Enforce32bit<void> final
{
struct void_0
{
void_0(...)
{
}
#include <iostream>
#include <tuple>
namespace
{
template<typename T>
using identity = T;
template<typename T, typename... V>
struct RAII_Set_impl