Skip to content

Instantly share code, notes, and snippets.

@nathan130200
nathan130200 / EventHandlerList.cs
Last active April 1, 2020 23:27
Thread-safe event handler system in C# using dynamic delegate
using System.Collections.Generic;
namespace System.Event
{
public class EventHandlerList
{
private class DelegateBinder
{
public readonly object Key;
private List<Delegate> Handlers;
@nathan130200
nathan130200 / TraceRoute.cs
Created July 1, 2020 12:14
.NET Async tracert with events.
using System.Net.Http;
namespace System.NetworkInformation
{
public class TraceRouteEventArgs
{
public TraceRoute Tracer { get; internal set; }
}
public class TraceRoutedEventArgs : TraceRouteEventArgs

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@nathan130200
nathan130200 / script.c
Last active July 21, 2020 00:35
Tiny overwatch - Workshop mode.
settings
{
lobby
{
Allow Players Who Are In Queue: Yes
Match Voice Chat: Enabled
}
modes
{
@nathan130200
nathan130200 / script.cs
Created July 24, 2020 00:36
Dummy Bots: Mercy Helper
settings
{
lobby
{
Map Rotation: Paused
Max Team 1 Players: 3
Max Team 2 Players: 3
Return To Lobby: Never
Swap Teams After Match: No
}
@nathan130200
nathan130200 / script.cpp
Last active August 3, 2020 20:13
Dead By Daylight Prototype in Overwatch Workshop
settings
{
lobby
{
Map Rotation: Paused
Max Team 1 Players: 10
Max Team 2 Players: 2
Return To Lobby: Never
Swap Teams After Match: No
}
@nathan130200
nathan130200 / example.py
Last active August 5, 2020 19:14
Simple POO for manage XML objects.
from xpnet import Attribute, Element
def run_server():
iq = Element("iq", "jabber:client")
iq.add_attribute("from", "my.server")
iq.add_attribute("to", "user@example/server")
iq.add_attribute("id", "uid00000005")
iq.add_attribute("type", "result")
@nathan130200
nathan130200 / Control.h
Last active October 14, 2020 01:36
ImGUI Wrapper for POO style in C++
#include <vector>
#include <imgui.h>
#include <string>
#ifndef _CONTROL_H_
#define _CONTROL_H_
struct Control
{
protected:
@nathan130200
nathan130200 / gamemode.c
Last active November 4, 2020 19:48
Workshop dynamic camera system (with editor)
settings
{
lobby
{
Allow Players Who Are In Queue: Yes
Data Center Preference: Brazil
Map Rotation: Paused
Return To Lobby: Never
}
@nathan130200
nathan130200 / _about.md
Last active December 3, 2020 01:42
Overwatch - Basic elapsed time clock for workshop.

Global Variables

clockData (index: 0) an array that will filled with clock data:

  • clockData[0]: hours
  • clockData[1]: minutes
  • clockData[2]: seconds

Tools

Every time will loop and update clock, incrementing values. If you need to detect clock updates you can make an copy of clockData then compare each value.