Skip to content

Instantly share code, notes, and snippets.

View NullEntity's full-sized avatar

Bryce Walther NullEntity

  • Philadelphia, PA
View GitHub Profile
@NullEntity
NullEntity / myshoutbox.js
Last active December 10, 2015 16:28 — forked from anonymous/myshoutbox.js
Updated showShouts function to only create the timer once.
// MyShoutbox for MyBB
// (c) Pirata Nervo, www.consoleworld.net
//
// Based off:
// SpiceFuse AJAX ShoutBox for MyBB
// (c) Asad Niazi, www.spicefuse.com!
//
// Code is copyrighted and does not belong to public domain.
// Copying or reusing in different forms/softwares isn't allowed.
//
{
:before => before,
:after => after,
:ref => ref,
:commits => [{
:id => commit.id,
:message => commit.message,
:timestamp => commit.committed_date.xmlschema,
:url => commit_url,
:added => array_of_added_paths,
-- returns `fn` which memoizes its arguments
local function memoize( fn )
local cache = {}
local function memoize(...)
-- convert args into a string if they're a table
local args = {...}
local sArg = table.ToString(args)
-- get the item with the given arguments from the cache
local cached = cache[sArg]