Skip to content

Instantly share code, notes, and snippets.

View ArnCarveris's full-sized avatar
🎯
R&D

Arn ArnCarveris

🎯
R&D
View GitHub Profile
@ArnCarveris
ArnCarveris / BlenderSyncLib.cpp
Last active August 6, 2025 16:28 — forked from unvestigate/BlenderSyncLib.cpp
BlenderSync addon
#include "BlenderSyncLibExport.h"
#include <enet/enet.h>
#include <stdio.h>
#include <stdint.h>
#include <string>
#include <fstream>
#include "../Basis/include/editor/BasisBlenderSync.h"
#include <https://raw.githubusercontent.com/SanderMertens/flecs/master/flecs.h>
#include <https://raw.githubusercontent.com/SanderMertens/flecs/master/flecs.c>
#include <https://gist.githubusercontent.com/ArnCarveris/535cf7c25007271bfa75d6396853a4a3/raw/99b57783a906995b4b89c4fb8d053c0ed2981603/flecs_godbolt.h>
typedef struct {
float x, y;
} Position, Velocity;
typedef struct {
float time;
@ArnCarveris
ArnCarveris / flecs_godbolt.h
Last active March 20, 2024 08:19
flecs for godbolt.org
#pragma once
#include <stdio.h>
static void flecs_safe_sigsegv(int sig, siginfo_t *info, void *uc_void)
{
fflush(stdout);
fflush(stderr);
}
static void flecs_safe_sethandler(int sig, void (*handler)(int, siginfo_t *, void *),
@ArnCarveris
ArnCarveris / dladdr-lambda-test.mm
Created March 19, 2024 12:55 — forked from bdash/dladdr-lambda-test.mm
Test of backtrace and dladdr with C++ lambdas
// c++ -framework Foundation -std=c++14 -o dladdr-lambda-test dladdr-lambda-test.mm
#import <Foundation/Foundation.h>
#include <cxxabi.h>
#include <dlfcn.h>
#include <execinfo.h>
@interface MyObject : NSObject
@end
@ArnCarveris
ArnCarveris / CustomDefines.cs
Created January 30, 2024 10:22 — forked from KevinThielen/CustomDefines.cs
[Unity] Create MenuItems dynamically to add/remove preprocessor macros.
using UnityEngine;
using UnityEditor;
using System.Text;
namespace MyUtil
{
[InitializeOnLoad]
public partial class CustomDefines
{
private const string ScriptPath = "/Util/Editor/MyDefines.cs"; //path including the name of to the (to be) generated File
@ArnCarveris
ArnCarveris / has_ostream_operator.cpp
Last active January 11, 2024 14:52
has_ostream_operator for C++98
#include <iostream>
#include <typeinfo>
namespace detail {
namespace has_ostream_operator_impl {
//!Typedef a char array of size one.
typedef char no;
#include <cassert>
#include <iostream>
#include <functional>
#include <memory>
#include <type_traits>
#include <typeinfo>
#include <typeindex>
#include <utility>
#include <unordered_map>

I think using scopes greatly improves readability. Here's an example of converting a larger section of code. The indenting makes it immediately clear when a scopes begins and ends. Both snippets of code draw the exact same controls.

Before:

EditorGUILayout.BeginVertical("box");
disable = EditorGUILayout.Toggle("Disable Sliders", disable);
indent = EditorGUILayout.IntSlider("Indent Sliders", indent, 1, 4);
command script import -c test_item.py
command script import -c test_list.py
command script import -c nlohmann_json.py
@ArnCarveris
ArnCarveris / lldb.txt
Created January 27, 2021 14:00 — forked from hotwatermorning/lldb.txt
Step into std::function with lldb of Xcode
(lldb) settings show target.process.thread.step-avoid-regexp
target.process.thread.step-avoid-regexp (regex) = ^std::
(lldb) settings set target.process.thread.step-avoid-regexp ""
http://stackoverflow.com/questions/19413181/step-into-stl-sources-in-xcode-5