Skip to content

Instantly share code, notes, and snippets.

View nilium's full-sized avatar
🍉
internal screaming intensifies

Noel nilium

🍉
internal screaming intensifies
View GitHub Profile
@nilium
nilium / classes.lua
Created May 13, 2011 20:29
Hackjob class/inheritance/whatnot stuff for Lua
--[[
Copyright (c) 2009 Noel R. Cower
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:
function lerpTable(delta, table)
-- assume table is sorted according to order
local peak = #table
for index = 1,#table do
if table[index][1] >= delta then
peak = index
break
end
end
@nilium
nilium / layout.js
Created December 24, 2011 00:22
Layout junk
/******************************************************************************
Copyright (c) 2011 Noel R. Cower
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:
class AnimationBlock
constructor: (@fps) ->
@millisecondsPerFrame = 1000.0 / fps
@animations = []
@interval = null
@callback =>
time = AnimationBlock.getTime()
animsCopy = @animations.slice(0) # copy the array
@nilium
nilium / glfw-test.coffee
Created March 25, 2012 23:17
GLFW/webgl test in CoffeeScript
glfw = require('node-glfw')
gl = require('node-webgl').webgl
glfw.Init()
glfw.OpenWindow 800, 600, 0, 0, 0, 0, 16, 0, glfw.WINDOW
glfw.events.addListener 'keyup', (event) ->
glfw.CloseWindow() if event.which is glfw.KEY_ESC
# /listener
@nilium
nilium / memory_pool.cc
Created April 13, 2012 06:52
Bizarro world memory pool stuff
/*
Copyright (c) 2012 Noel Cower
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:
@nilium
nilium / LicenseSettings.sublime-settings
Created April 19, 2012 04:46
License plugin for Sublime Text 2
{
"full_name": "A Nameless Jerk",
"license_wrap": 80
}
# comment
# test
_abra!(a, b = nil) -> {
# foobaz
_abra! = ->{ _abra! = 5; NULL } # wooperton
} # burp
ab = c * foo(bar) + 5
# comment
# test
_abra!(a, b = nil) -> {
# foobaz
_abra! = -> { _abra! = 5; NULL } # wooperton
} # burp
ab = c * foo(bar) + 5
# this
class foo {
class sublcass < foo {
woop(derp) -> {
derp(derp)
}
}
}
# is the same as this