Skip to content

Instantly share code, notes, and snippets.

View atcarter714's full-sized avatar
⛈️
Head in the cloud ...

Aaron Carter atcarter714

⛈️
Head in the cloud ...
View GitHub Profile
@atcarter714
atcarter714 / AssistantsSchemas.cs
Created April 3, 2025 19:12
A C# script file (CSX) implementing the OpenAI API (also works as regular C# code) ...
/* --------------------------------------------------------------------------------
* Notes (AssistantsSchemas.cs) ::
* --------------------------------------------------------------------------------
* This file contains a set of classes and interfaces that define the structure
* of the JSON objects that are used to interact with the OpenAI API. These objects
* are used to serialize and deserialize JSON data to and from C# objects.
* We use System.Text.Json for this purpose, and the classes in this file are
* designed to work with the default JSON serialization options provided by the
* System.Text.Json library (higher performance than Newtonsoft.Json).
*
@atcarter714
atcarter714 / FastParser.cs
Created February 24, 2024 05:24
Extreme high-performance digit/number parsing of UTF-8 text data in C# ...
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace Arkaen.LowLevel {
@atcarter714
atcarter714 / EventsInCSharpExample.cs
Last active March 28, 2023 04:04
An example of events with accessors and basic "thread-safety" precautions in C# (applies to several language versions) ...
#define DEV_BUILD
#region Using Directives
using System;
using System.Drawing;
using System.Reflection;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
#endregion
@atcarter714
atcarter714 / Program.cs
Created March 19, 2023 23:15
Read a OneNote hierarchy in C# ....
static void Main(string[] args) {
// OneNote 2013 Schema namespace.
string strNamespace = "http://schemas.microsoft.com/office/onenote/2013/onenote";
string outputXML;
Application onApplication = new Application();
onApplication.GetHierarchy(null, HierarchyScope.hsSections, out outputXML);
// Load a new XmlDocument.
XmlDocument xmlDoc = new XmlDocument();
@atcarter714
atcarter714 / SimulatingUnityNull.cs
Last active May 8, 2025 20:18
Clearing up the confusion about how null-ness of Unity Objects works with a very simple simulation of it!
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Here we simulate a managed object using native memory resources which has the same
// behavior as a Unity Object with "null-ness" and checks. It demonstrates why if(obj)
// is usually how you should be doing your checks ...
internal class Program
{
private static void Main( string[] args )
@atcarter714
atcarter714 / Directory.Build.props
Created November 19, 2022 21:46
Defines a custom Directory.Build.props file for large, SDK-style projects in Visual Studio 2022 + MSBuild with custom intermediate and build output directories (W.i.P.)
<Project Sdk="Microsoft.NET.Sdk">
<!--Version 0.1.2 of Directory.Build.props-->
<!-- Additional Solution Properties and Info -->
<PropertyGroup Label="ExtraInfo">
<OwnerName>Yourfirst McLastname, Jr.</OwnerName>
<Developers>$(OwnerName);</Developers>
<DevGitHubPage>https://github.com/atcarter714</DevGitHubPage>
<CompanyWebsite>https://github.com/atcarter714</CompanyWebsite>
@atcarter714
atcarter714 / sparseconfig.h
Created November 16, 2022 05:24
Modified version of "sparseconfig.h" to fix IL2CPP build failures in Unity-generated UWP solutions for building your game for UWP (i.e., Windows Store, XBox Store, etc)
/*
* NOTE: This file is for internal use only.
* Do not use these #defines in your own program!
*/
/* MODIFIED FILE: --------------------------------------------------------------------------------------
* Since Unity 2022.2b versions fail when trying to build your project for Windows, UWP, etc, this file
* must be modified with a special preprocessor directive so that IL2CPP doesn't use the incorrect headers
* and freak out on you. I defined it just above the place where it defines the SPARSEHASH_HASH and the
* SPARSEHASH_HASH_NO_NAMESPACE symbols. I have only tested this on Windows in Visual Studio, but there are
@atcarter714
atcarter714 / MsvcStdextWorkaround.cs
Last active November 16, 2022 06:31
Unity 2022.1 and 2022.2 beta fix for building your game: Without this code Unity cannot build your game and IL2CPP fails!
#if UNITY_EDITOR
using System;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
public class MsvcStdextWorkaround : IPreprocessBuildWithReport
{
const string kWorkaroundFlag = "/D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS";
public int callbackOrder => 0;
public void OnPreprocessBuild(BuildReport report)
{
@atcarter714
atcarter714 / CountdownBehaviour.cs
Created June 29, 2022 20:08
A handy timer system for Unity utilizing the SOLID principles
#region Using Directives
using System;
using UnityEngine;
using UnityEngine.Events;
#endregion
/// <summary>
@atcarter714
atcarter714 / JSONObjects.cs
Created April 27, 2022 21:12
Easy JSON serialization for data-container classes
#region Using Directives
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using UnityEngine;
#endregion