Skip to content

Instantly share code, notes, and snippets.

View springuper's full-sized avatar
👻
Happy Hacking

chun shang springuper

👻
Happy Hacking
View GitHub Profile
@springuper
springuper / gist:c3b625e40707d969d43b
Last active September 9, 2015 07:23 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

/* Use this to cause a function to fire no more than once every 'ms' milliseconds.
For example, an expensive mousemove handler:
$('body').mouseover(ratelimit(function(ev) {
// ...
}, 250));
*/
function ratelimit(fn, ms) {
var last = (new Date()).getTime();