Skip to content

Instantly share code, notes, and snippets.

View TannerRogalsky's full-sized avatar
💯
P I X E L S

Tanner Rogalsky TannerRogalsky

💯
P I X E L S
View GitHub Profile
local Class = setmetatable({
new = function(arg1, arg2, arg3)
local obj = {}
obj.var1 = arg1
obj.var2 = arg2
obj.var3 = arg3
obj.out = function (self, arg)
print(self[arg])
end

Keybase proof

I hereby claim:

  • I am tannerrogalsky on github.
  • I am tanner (https://keybase.io/tanner) on keybase.
  • I have a public key whose fingerprint is 704D D862 7B9C E402 4957 D515 302E E7BF A5C7 B82F

To claim this, I am signing this object:

@TannerRogalsky
TannerRogalsky / line.lua
Created March 23, 2014 15:37
Lightweight Ray Object
--[[
Copyright (c) 2014 Tanner Rogalsky
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, subject to the following conditions:
@TannerRogalsky
TannerRogalsky / Loom.cs
Created February 25, 2014 21:56
threaded job queue
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Threading;
using System.Linq;
public class Loom : MonoBehaviour
{
public static int maxThreads = 8;
@TannerRogalsky
TannerRogalsky / main.lua
Created February 16, 2014 00:07
segfaulting love2d with coroutines and user data
function love.load(args)
love.physics.setMeter(60)
World = love.physics.newWorld(0, 10 * 16, true)
World:setCallbacks(function(fixture_a, fixture_b, contact)
print(fixture_a, fixture_b)
local data_a, data_b = fixture_a:getUserData(), fixture_b:getUserData()
print("I never run because of segfault.")
end)
|1 2 3 4 5 6 7 8|D E|
=|===============|===|
| |0 1|
-|---------------|---|
A|4 H @ 8 N L D <| |
Q|3 G ? 7 O K C ;| |
S|5 I A 9 Q M E =| |
W|2 F > 6 P J B :| |
======================
@TannerRogalsky
TannerRogalsky / set.lua
Last active June 21, 2020 04:46
A simple set implementation in lua
local Set = {}
function Set.new()
local reverse = {}
local set = {}
return setmetatable(set, {
__index = {
insert = function(set, value)
if not reverse[value] then
table.insert(set, value)
require "gd"
function project(px, py, pz, win_width, win_height, fov, cam)
local factor = fov / (cam+pz)
local x = px*factor + win_width/2
local y = -py*factor + win_height/2
return x, y
end
local base = gd.createFromJpeg("base.jpg")
function love.load()
player = {
grid_x = 256,
grid_y = 256,
act_x = 256,
act_y = 256,
speed = 10
}
map = {
@TannerRogalsky
TannerRogalsky / CyberBot.java
Created December 19, 2012 02:36
A bot to play cyberzone
package main;
import java.util.*;
import org.jibble.pircbot.*;
public class CyberBot extends PircBot {
boolean noGame = true, prep, inGame;
String chan = "#cyberzone";
ArrayList<Player> players = new ArrayList<Player>();