Skip to content

Instantly share code, notes, and snippets.

Avatar
🔨
Working on some code

Tom Hancocks tjhancocks

🔨
Working on some code
View GitHub Profile
@tjhancocks
tjhancocks / rez.c
Created Dec 17, 2019
rez file format parser
View rez.c
//
// MIT License
//
// Copyright (c) 2016 Tom Hancocks
//
// 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
// copies of the Software, and to permit persons to whom the Software is
@tjhancocks
tjhancocks / cross-gcc.sh
Created Dec 13, 2017
OS Dev Cross Compiler (i686-elf-gcc)
View cross-gcc.sh
#!/bin/sh
# Options
PREFIX="$HOME/opt/cross"
TARGET="i686-elf"
DEST="/tmp/osdev"
# Add to the path, and add it to the bash profile
export PATH="$PREFIX/bin:$PATH"
View ObjectFactory.swift
import ObjectiveC
class ObjectFactory {
let internalClass: AnyClass
var rawMemory: UnsafeMutablePointer<Void>?
init(usingClass klass: AnyClass) {
self.internalClass = klass
constructInstance()
}
@tjhancocks
tjhancocks / FileLib.swift
Last active Sep 10, 2015
FileLib (Swift)
View FileLib.swift
/*
The MIT License (MIT)
Copyright (c) 2015 Tom Hancocks
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 copies of
the Software, and to permit persons to whom the Software is furnished to do so,
View Dispatch.swift
import Dispatch
import Foundation
/// The thread enumeration acts as a simple way of requesting a thread
/// through out the app.
enum Thread {
case Any
case Main
case Background
case Concurrent(String)
@tjhancocks
tjhancocks / memory.c
Last active Aug 29, 2015
A memory management module for C pointers
View memory.c
/*
The MIT License (MIT)
Copyright (c) 2015 Tom Hancocks
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 copies of
the Software, and to permit persons to whom the Software is furnished to do so,
@tjhancocks
tjhancocks / CircleDetector.java
Created May 22, 2012
Circular Motion Direction Detection
View CircleDetector.java
import java.awt.*;
import java.awt.event.*;
public class CircleDetector extends Frame implements MouseMotionListener {
private Label direction = null;
// These two variables help us detect the direction and circular motion.
private double lastAngle = 0;
private boolean antiClockwise = true;