Skip to content

Instantly share code, notes, and snippets.

--[[---------------------------------------------------------------------------------
GCTweaker by Cladhaire <[email protected]>
A small addon designed to perform more aggressive garbage collection in
higher FPS situations. This will not magically fix any memory issues,
but will help a garbage collection cycle to complete quicker
----------------------------------------------------------------------------------]]
-- Initialize default saved variables
GCTweakerDB = {
@jnwhiteh
jnwhiteh / irc-lpeg.lua
Created June 3, 2017 15:53
An LPEG grammar for the IRC protocol
require("luarocks.require")
require("lpeg")
local v = lpeg.V
local c = lpeg.C
local grammar = {
"message", -- Initial rule
message = (v"COLON" * c(v"prefix"))^-1 * c(v"command") * c(v"params") * v"CRLF",
params = v"SPACE" * ((v"COLON" * v"trailing") + (v"middle" * v"params"))^-1,
nospcrlfcl = lpeg.R("\001\009", "\011\012", "\014\031", "\033\057", "\059\255"),
a = [
0b10000000,
0b01000000,
0b00100000,
0b00010000,
0b00011000,
0b00000100,
0b00010010,
0b00010001,
]
@jnwhiteh
jnwhiteh / Array.java
Created January 6, 2016 22:15
An example of implementing Iterable and Iterator in Java
import java.util.Iterator;
import java.util.NoSuchElementException;
// Introduction:
//
// This is an example class meant to illustrate several differen concepts:
// * The use of type parameters (i.e. Java generics)
// * Implementing an iterator over some collection, in this case an array
// * Implementing the Iterable interface, which enables your collection
// to work with the Java simple for loops, i.e. (for String s : list)
--[[
Name: Astrolabe
Revision: $Rev: 161 $
$Date: 2014-10-14 22:59:04 -0700 (Tue, 14 Oct 2014) $
Author(s): Esamynn (esamynn at wowinterface.com)
Inspired By: Gatherer by Norganna
MapLibrary by Kristofer Karlsson (krka at kth.se)
Documentation: http://wiki.esamynn.org/Astrolabe
SVN: http://svn.esamynn.org/astrolabe/
Description:
@jnwhiteh
jnwhiteh / expectations.go
Created October 16, 2014 19:52
Expectations
package sqlmock
import (
"database/sql/driver"
"reflect"
"regexp"
)
// commonExpectation is a set of attributes that are common to all
// expectations.
@jnwhiteh
jnwhiteh / gist:10519898
Created April 12, 2014 05:17
keybase.md
### Keybase proof
I hereby claim:
* I am jnwhiteh on github.
* I am jnwhiteh (https://keybase.io/jnwhiteh) on keybase.
* I have a public key whose fingerprint is 750E D5CD F669 0A72 3D21 B0B3 0646 4D1A EEA9 6B67
To claim this, I am signing this object:
@jnwhiteh
jnwhiteh / After.lua
Created June 19, 2013 18:00
An example addon showing a simple frame in XML used in Lua
print("After the XML is loaded", FrameTestFrame)
local seconds = 10
local total = 0
FrameTestFrame:SetScript("OnUpdate", function(self, elapsed)
total = total + elapsed
if total > seconds then
self:SetScript("OnUpdate", nil)
end
local sides = 100 + (100 * (total / seconds))
print("After the XML is loaded", FrameTestFrame)
local seconds = 10
local total = 0
FrameTestFrame:SetScript("OnUpdate", function(self, elapsed)
total = total + elapsed
if total > seconds then
self:SetScript("OnUpdate", nil)
end
local sides = 100 + (100 * (total / seconds))
@jnwhiteh
jnwhiteh / pom.xml
Created June 27, 2012 14:29
Maven build file for aepfacts database
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.develogical</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>aepfacts</artifactId>
<dependencies>
<dependency>