Skip to content

Instantly share code, notes, and snippets.

View tilkinsc's full-sized avatar
▶️
Working on Lua.NET

Cody Tilkins tilkinsc

▶️
Working on Lua.NET
View GitHub Profile
@tilkinsc
tilkinsc / init.lua
Created January 25, 2023 19:19
Lua but Functional
local sub = string.sub
local concat = table.concat
local insert = table.insert
string.where = function(self, predicate)
local buf = {}
for i = 1, #self do
local ch = sub(self, i, i)
if (predicate(ch)) then
insert(buf, ch)
end
@tilkinsc
tilkinsc / JsonSerializable.cs
Created January 10, 2023 18:39
Effective Json serialization for C# CSharp classes
using System.Text.Json;
namespace Meerkat.Json;
public interface IJSONSerializable
{
}
/// <summary>
/// Implements the ability to load JSON files. By default, if the json file
@tilkinsc
tilkinsc / TwoWayMemoryStream.cs
Created September 10, 2022 23:03
A memory stream will advance on read, this reduces the position.
using System.Runtime.InteropServices;
namespace Util;
class TwoWayMemoryStream : MemoryStream
{
private byte[] _buffer;
private TwoWayMemoryStream()
@tilkinsc
tilkinsc / ddsload.cs
Last active August 19, 2022 20:14
C# rudimentary loading DDS for OpenGL using Silk.NET
enum DDSD
{
NONE = 0x00,
CAPS = 0x01,
HEIGHT = 0x02,
WIDTH = 0x04,
PITCH = 0x08,
PIXELFORMAT = 0x1000,
MIPMAPCOUNT = 0x20000,
LINEARSIZE = 0x80000,
@tilkinsc
tilkinsc / main.cpp
Last active February 20, 2024 01:34
WGL Full Demo
/**
*
* MIT License
*
* Copyright (c) 2017-2022 Cody Tilkins
*
* 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
@tilkinsc
tilkinsc / class.lua
Created May 12, 2022 01:08
Function Environment go boom
local class = {}
-- Derived from: http://lua-users.org/wiki/CopyTable
-- Copies a table
local shallowcopy = function(o)
local c = {}
if (type(o) ~= "table")then
c = o
return c
@tilkinsc
tilkinsc / main.cpp
Last active October 8, 2022 18:34
Getting fully started with wgl
See https://gist.github.com/tilkinsc/7f383faccf3722622f5d0cc9bd45e7e6
@tilkinsc
tilkinsc / podping.bat
Created October 9, 2020 03:57
Tests american Path of Diablo server pings
@echo off
title PoD ping -a -n 10 -4 -w 500 Tester
echo Note: If you get stuck, press Ctrl+C then enter 'n' then hit enter again.
echo gs 1
ping -a -n 10 -4 -w 500 173.214.173.56
echo gs 3
ping -a -n 10 -4 -w 500 64.235.46.70
@tilkinsc
tilkinsc / GLUtil.hpp
Created June 2, 2020 06:54
Default glfw and ogl error callbacks
#pragma once
#include <stdio.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
@tilkinsc
tilkinsc / build.bat
Created November 30, 2019 10:11
How to survive without makefile
@echo off
setlocal
REM Default env vars
IF NOT DEFINED debug set debug=0
IF NOT DEFINED debug_coverage set debug_coverage=0
IF NOT DEFINED GCC set GCC=gcc
IF NOT DEFINED AR set AR=ar
IF NOT DEFINED MAKE set MAKE=make