Skip to content

Instantly share code, notes, and snippets.

@Enhex
Enhex / Optimal usage of tabs and spaces.txt
Created January 13, 2018 10:04
Optimal usage of tabs and spaces
Optimal usage of tabs and spaces
================================
Goal:
Minimize number of characters used while keeping everything aligned with any tab size.
Tabs should be used to align text from the same line position, so having different tab size won't misalign the text.
Spaces should be used when the line position isn't aligned, and when it becomes aligned after the spaces tabs should be used.
examples:
/*
The MIT License (MIT)
Copyright (c) 2017 Yehonatan Ballas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
/*
The MIT License (MIT)
Copyright (c) 2016 Yehonatan Ballas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
#include <unordered_map>
#include <cereal\types\unordered_map.hpp>
#include <cereal\archives\json.hpp>
#include <cereal\details\traits.hpp>
#include <fstream>
class Test
{
public:
std::unordered_map<std::string, int> map_int;
@Enhex
Enhex / Urho3D render order behind.cpp
Last active August 20, 2017 19:48
Urho3D render order in front
Node* planeNode = scene_->CreateChild("Plane");
planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
auto mat = cache->GetResource<Material>("Materials/StoneTiled.xml")->Clone();
mat->SetRenderOrder(100); // Lower render order to render first
auto tecs = mat->GetTechniques();
for (size_t i = 0; i < tecs.Size(); ++i)
{
/*
The MIT License (MIT)
Copyright (c) 2016 Yehonatan Ballas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
#include <chrono>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <string>
#include <Urho3D/Urho3D.h>
#include <Urho3D/Container/Vector.h>
#include <Urho3D/Container/HashMap.h>