Skip to content

Instantly share code, notes, and snippets.

View JackStouffer's full-sized avatar
💭
I may be slow to respond. Email me.

Jack Stouffer JackStouffer

💭
I may be slow to respond. Email me.
View GitHub Profile
@d7samurai
d7samurai / .readme.md
Last active March 25, 2024 10:45
Minimal D3D11 sprite renderer

Minimal D3D11 sprite renderer

Minimal D3D11 sprite renderer: basic back-to-front sprite rendering reference code with example sprite sheet animation logic. As usual: Complete, runnable single-function app. No modern C++ / OOP / obscuring cruft.

adventurer

Swap out the sprite sheet with a font atlas for a lightweight GUI / text renderer. Clip individual sprites and glyphs by offsetting screenPos and atlasPos to top left corner of visible area and adjusting size accordingly (all values in pixels):

sprite.screenPos.x += 17;
sprite.screenPos.y += 10;
@d7samurai
d7samurai / .readme.md
Last active March 2, 2024 23:44
Minimal WASAPI

Minimal WASAPI

Minimal WASAPI reference implementation. Runnable console application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. Produces a steady sine wave sound.

(This is a re-post of the same gist I posted a few years earlier, simply due to me wanting the Minimal D3D11 series to be listed contiguously and it's not possible to hide or rearrange gists).

@easyaspi314
easyaspi314 / change_case_simd.c
Created February 6, 2019 06:06
SIMD functions to apply toupper/tolower to each character in a string
/* Created by easyaspi314. Released into the public domain. */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __SSE2__
#include <immintrin.h>
@MightyPork
MightyPork / usb_hid_keys.h
Last active May 1, 2024 05:11
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
@ximion
ximion / dlang-quirks.md
Last active February 18, 2019 19:21
D Issue List

D Issue List

This is a list of issues I encounter when working with the D programming language, and which I find annoying or which limit what I can do with D.

The selection of these issues is completely subjective, I keep it here for personal reference and possibly for others who might want to fix one of these problems or just want to know about the problems I see with D.

Despite all of the issues, I think D is a useful language, otherwise I wouldn't use it and put effort

@esjewett
esjewett / example.js
Last active March 29, 2020 19:02
Example of Reductio/Crossfilter moving average w/ efficient Date calculations for larger data set
// This example data set (not provided) is over 100,000 records. The following code calculates 30-day moving
// averages (over 3 million aggregations) using Crossfilter and the Reductio helper library. It takes about
// 3 seconds for the initial aggregation in Chrome Canary (42.0.2291.0) on a 2.3 GHz Core i7, mid-2012 rMBP.
d3.csv('dataJan-29-2015.csv', function (data) {
//convert the iso timestamps to JS Dates
var parseDate = d3.time.format("%Y-%m-%dT%H:%M:%S").parse;
var ymd = d3.time.format("%Y-%m-%d");
data.forEach(function(d) {
@gamesbyangelina
gamesbyangelina / heroname.py
Created June 14, 2013 04:27
Quick Python script that uses Tony Veale's Metaphor Magnet (http://ngrams.ucd.ie/metaphor-magnet-acl) to generate poetic descriptions of heroes. Nothing fancy, just playing around.
from xml.etree import ElementTree as ET
import urllib
import os
import itertools, random
plus = "%2B"
neg = "-"
def getText(nodelist):
rc = []