Skip to content

Instantly share code, notes, and snippets.

View hamaluik's full-sized avatar
👋
I may be slow to respond.

Kenton Hamaluik hamaluik

👋
I may be slow to respond.
View GitHub Profile
@hamaluik
hamaluik / !DevConsole.hx
Created April 9, 2015 06:46
Showing how to use macros to get a list of all methods with a specific metadata at runtime. Very kludgey, my first attempt, but it works.
package dc;
import dc.DevConsoleInjector;
import haxe.macro.Context;
import haxe.macro.Expr;
typedef ConsoleCommand = {
var className:String;
var methodName:String;
}
@hamaluik
hamaluik / !Profiler.hx
Last active April 6, 2020 23:11
Simple Haxe Profiler
package ;
import haxe.ds.StringMap;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Printer;
import haxe.macro.Type.ClassType;
import neko.Lib;
using haxe.macro.ExprTools;
@hamaluik
hamaluik / adxl345_spi.c
Created March 6, 2015 15:53
How to use the ADXL345 accelerometer with a Teensy (through SPI).
//Add the SPI library so we can communicate with the ADXL345 sensor
#include <SPI.h>
//Assign the Chip Select signal to pin 10.
int CS=10;
//ADXL345 Register Addresses
#define DEVID 0x00 //Device ID Register
#define THRESH_TAP 0x1D //Tap Threshold
#define OFSX 0x1E //X-axis offset
@hamaluik
hamaluik / ThreadPool.hx
Last active December 19, 2023 09:59
Platform-agnostic thread pool for Haxe / OpenFL
package com.blazingmammothgames.util;
#if neko
import neko.vm.Thread;
import neko.vm.Mutex;
#elseif cpp
import cpp.vm.Thread;
import cpp.vm.Mutex;
#end
@hamaluik
hamaluik / AABB.hx
Created October 6, 2014 05:38
Continuous collision detection between two moving AABBs using Minkowski differences.
package ;
import openfl.display.Sprite;
/**
* ...
* @author Kenton Hamaluik
*/
class AABB
{
public var center:Vector = new Vector();
@hamaluik
hamaluik / AABB.hx
Last active March 14, 2024 16:57
Minkowski Difference Collision Detection
package ;
import openfl.display.Sprite;
/**
* ...
* @author Kenton Hamaluik
*/
class AABB
{
public var center:Vector = new Vector();
@hamaluik
hamaluik / markdown_thirdparty.py
Created September 25, 2014 23:58
A Pelican plugin to enable third party Markdown extensions
# -*- coding: utf-8 -*-
"""
Markdown Third Party
============================
This plugin allows you to use various third-party
Markdown extensions to make writing posts in Markdown
easier and better.
"""
#!/usr/bin/env python
print '+----------------------------------------+'
print '| GradeMe-Watchman Bot by /u/FuzzyWuzzie |'
print '+----------------------------------------+'
import praw
from pprint import pprint
from datetime import datetime
import sys
import time
import math
@hamaluik
hamaluik / secondsToHMS
Created November 15, 2013 00:54
This isn't something that is very difficult. However, I often find I need to do the conversion from total number of seconds (example: 5412s) to the number of hours, minutes, and seconds that is (hh:mm:ss - 1:30:12 in this case). Here is a little snippet in Python that does this.
# secs is the total number of seconds
secs = 5412
# calculate things..
hours = secs / 3600
minutes = (secs - hours * 3600) / 60
seconds = secs % 60
# now print the results!
print '%02d:%02d:%02d' % (hours, minutes, seconds)
@hamaluik
hamaluik / listOfSymbols.tex
Created January 30, 2013 23:16
List of symbols, taken from http://filer.case.edu/oxb6/listofsymbols.html for ease of use with Gists
%% Your packages
\usepackage{array} %for vertical thick lines in tables
\usepackage{multirow} %multirow tables
\usepackage{nicefrac} %for fractions like 1/4
%Package list ends here
% Macro for 'List of Symbols', 'List of Notations' etc...
\def\listofsymbols{\input{symbols} \clearpage}
\def\addsymbol #1: #2#3{$#1$ \> \parbox{5in}{#2 \dotfill \pageref{#3}}\\}