Skip to content

Instantly share code, notes, and snippets.

View faceleg's full-sized avatar

Michael Robinson faceleg

  • Auckland, New Zealand
View GitHub Profile
@faceleg
faceleg / ajax-run-data-scripts.html
Last active December 12, 2015 02:58
Template for jQuery ajax handler that runs scripts contained in the returned data.
<form action="" method="post">
<input type="text" name="name" />
<button type="submit">Submit</button>
</form>
<div id="result"></div>
<script type="src/javascript">
$.ajax({
type: 'POST',
url: location.href,
@faceleg
faceleg / debouncer.js
Created September 6, 2012 02:01
JS Debouncer
/**
* Debouncer function to prevent multiple calls from a repeatedly called event
* @link http://stackoverflow.com/a/4298672/187954
* @link https://gist.github.com/3649866
* @param {Function} callback A callback to execute when timeout is reached with no subsequent calls.
* @param {Integer|null} timeout A custom timeout or null for 200
* @return {Function} The debouncer function.
*/
function eventDebouncer(callback, timeout) {
timeout = timeout || 200;
@faceleg
faceleg / sdFATLinks.js
Created July 29, 2012 20:45 — forked from seyDoggy/sdFATLinks.js
jQuery for adding Font Awesome icons to toolbar 1