Skip to content

Instantly share code, notes, and snippets.

View tjhancocks's full-sized avatar
🔨
Working on some code

Tom Hancocks tjhancocks

🔨
Working on some code
View GitHub Profile
@tjhancocks
tjhancocks / rez.c
Created December 17, 2019 04:23
rez file format parser
//
// 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 December 13, 2017 13:49
OS Dev Cross Compiler (i686-elf-gcc)
#!/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"
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 September 10, 2015 08:29
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,
@tjhancocks
tjhancocks / Dispatch.swift
Last active August 29, 2015 14:24
GCD Stuffs
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 August 29, 2015 14:16
A memory management module for C pointers
/*
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 11:30
Circular Motion Direction Detection
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;