Skip to content

Instantly share code, notes, and snippets.

@victorholt
victorholt / forEach.cpp
Created April 24, 2017 17:12
C++ ForEach Example
#include <iostream>
#include <string>
#include <functional>
#include <vector>
template<class ArrayType, class ValueType>
void forEach(const ArrayType& arr, std::function<void(const ValueType&)> callback) {
for (auto entry : arr) {
callback(entry);
}
@victorholt
victorholt / array1d_array_2d_example.cpp
Created March 14, 2021 23:00
Simple Array 1D to Array 2D and back
#include <iostream>
#include <string>
#include <vector>
static std::vector<int> map;
static int mapSize = 3;
int initMap()
{
for (int i = 0; i < (mapSize * mapSize); i++) {
@victorholt
victorholt / docker_notes.sh
Created February 12, 2019 16:38
Docker Notes
# Run image and keep it going.
docker run --name alpine_os -it -d alpine tail -f /dev/null
@victorholt
victorholt / alloc_test.cpp
Created May 26, 2018 18:39
C++ Memory Pool Allocation
// Example program
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
#include <cstring>
#include <assert.h>
using namespace std;
template<typename T>
@victorholt
victorholt / CustomMesh.h
Last active May 14, 2018 03:23
Urho3D CustomMesh Header
//
// Created by Victor Holt on 3/18/2017.
// Reference: (rbnpontes) http://discourse.urho3d.io/t/a-mesh-generator/2361
//
#pragma once
#include <gs-common/PreCompiledHeadersUrho.h>
using namespace Urho3D;
namespace Sencha
{
@victorholt
victorholt / CustomMesh.cpp
Last active May 14, 2018 03:23
Urho3D Custom Mesh Source
//
// Created by Victor Holt on 3/18/2017.
//
#include <rogue-game/graphics/CustomMesh.h>
using namespace Urho3D;
using namespace Sencha;
//! Constructor.
//! \param context
//! \param isDynamic
@victorholt
victorholt / installer.go
Created March 7, 2018 18:44
Docker Installer
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"reflect"
"regexp"
"strings"
@victorholt
victorholt / CustomMesh.cpp
Last active November 27, 2017 00:25
CustomMesh Source
//
// Created by Victor Holt on 3/18/2017.
//
#include <GameSencha/Game/Graphics/CustomMesh.h>
#include <GameSencha/Core/SenchaLogger.h>
gs_namespaces
//! Constructor.
//! \param context
//! \param isDynamic
@victorholt
victorholt / CustomMesh.h
Last active November 27, 2017 00:24
CustomMesh Header
//
// Created by Victor Holt on 3/18/2017.
// Reference: (rbnpontes) http://discourse.urho3d.io/t/a-mesh-generator/2361
//
#pragma once
#include <GameSencha/Common/GameSenchaBasePCH.h>
gs_nsstart
#define CM_MAX_FACES_PER_GEOM_SM 500
#define CM_MAX_FACES_PER_GEOM_LG 25000
@victorholt
victorholt / CustomMesh.cpp
Last active June 27, 2017 03:50
CustomMesh Src Refactored
//
// Created by Victor Holt on 3/18/2017.
//
#include <gs-graphics/CustomMesh.h>
using namespace Urho3D;
using namespace Sencha;
//! Constructor.
//! \param context
//! \param isDynamic