Skip to content

Instantly share code, notes, and snippets.

Avatar

Cullen Johnson cullenjohnson

View GitHub Profile
@cullenjohnson
cullenjohnson / JQuery flash.js
Last active Aug 29, 2015
Flashes the selected element a certain color or style for a configurable number of seconds (without needing jQuery UI).
View JQuery flash.js
jQuery.fn.extend({
/** $().flash(options)
*
* Author: Cullen Johnson
* URL: https://gist.github.com/cullenjohnson/3d529bbfc7a555d1e640
*
* Description:
* Flashes an element's background-color, then fades back to the element's original background-color
*
* REQUIRES jQuery 1.4+ (jQuery UI is NOT needed)
@cullenjohnson
cullenjohnson / GetSearchTermRelevanceComparator.js
Last active Aug 29, 2015
Returns a compare function to be used in JavaScript's `Array.prototype.sort()` function that finds the string match of a search term nearest to the start of the word.
View GetSearchTermRelevanceComparator.js
/** GetSearchTermRelevanceComparator
* Author: Cullen Johnson
* Github: https://github.com/cullenjohnson
* Website: cullenjohnson.ca
*
* Return an underscore sort comparator that can sort a list of strings based on the relevancy of the search term.
* Can be used to sort strings, objects with string properties, or Backbone objects with string properties.
*
* Search Priority: (Example search term: "FOO")
* 1. Exact match of search term ("FOO" > "super FOObar")
@cullenjohnson
cullenjohnson / FilterSelectView.js
Created Oct 1, 2015
Backbone <select> tag replacement inspired by the "Burn your select tags" talk by Alice Bartlett at EpicFEL 2014: https://www.youtube.com/watch?v=CUkMCQR4TpY
View FilterSelectView.js
/**
* FilterSelectView
* Creator: Cullen
*/
FilterSelectView = Backbone.View.extend({
/** -----------------------------------
* DESCRIPTION
* ------------------------------------
*
You can’t perform that action at this time.