Skip to content

Instantly share code, notes, and snippets.

View wortelstoemp's full-sized avatar

Tom Quareme wortelstoemp

View GitHub Profile
@wortelstoemp
wortelstoemp / cl-cheatsheet.lisp
Created May 13, 2020 13:19
Common Lisp Cheatsheet
;;;; Cheatsheet for Common Lisp
;;; REFERENCES
;;; - Info: https://anticrisis.github.io/2017/09/04/how-i-got-started-with-common-lisp-2017.html
;;; - Learning Common Lisp:
;;; http://www.newthinktank.com/2015/07/learn-lisp-one-video/
;;; https://lispcookbook.github.io/cl-cookbook/
;;; (Advanced) http://www.gigamonkeys.com/book/
;;; - Exercises:
;;; http://www.4clojure.com/problems
// Add content here
@wortelstoemp
wortelstoemp / php_cheatsheet.php
Last active May 13, 2020 13:17
PHP Cheatsheet
<?php
// Call this script as: http://localhost/kp-test/backend/php_cheatsheet.php?id=100
// INCLUDING OTHER FILES:
# include 'sayhello.php';
header('Content-type: text/plain');
define('PI', 3.141592);
@wortelstoemp
wortelstoemp / tq_nn.h
Last active November 23, 2018 10:44
Neural Network From Scratch
#pragma once
// Proof of concept so I know how a neural network is built under the hood.
// Author: Tom Quareme
// TODO: https://www.youtube.com/watch?v=MJ_7qe--cvo 2-2
#include <iostream>
#include <vector>
#include <cmath>
@wortelstoemp
wortelstoemp / tq_ecs.h
Created May 25, 2018 00:11
Data Oriented Entity Component System
// Data Oriented Entity Component System
// Author: Tom Quareme
// Copyright 2018
#pragma once
#include <iostream>
#include <cstdio>
#include <ctime>
#include <map>
@wortelstoemp
wortelstoemp / math.h
Created October 11, 2017 10:57
Math library for 2D and 3D games
#pragma once
// Math library for 2D and 3D games
// Coordinate systems are exclusively right-handed!
// SIMD optimization might be added in the future.
//
// Author: Tom Quareme
#include <cmath>
@wortelstoemp
wortelstoemp / core.cpp
Last active October 11, 2017 19:13
Data-Oriented Entity Component System
#include "core.h"
namespace tqECS
{
tqECS::TransformComponentSystem::TransformComponentSystem()
{
std::srand(std::time(NULL));
}
void tqECS::TransformComponentSystem::Allocate(unsigned int allocatedCount)
@wortelstoemp
wortelstoemp / memory_management.c
Last active August 29, 2017 14:12
Memory management in C. This is probably the only use-case I've encountered where usage of the keyword "goto" actually simplifies a lot of code and headaches concerning memory management in C. I use "malloc" and the corresponding "free" in the same function. I don't know if there are better ways to do this without overcomplicating it.
#include <stdio.h>
#include <string.h>
int foo(void)
{
/* Declarations and allocations */
int result = 0;
char *buffer1 = (char *)malloc(100 * sizeof(char));
int *buffer2 = (int *)malloc(100 * sizeof(int));
float *buffer3 = (float *)malloc(100 * sizeof(float));