Skip to content

Instantly share code, notes, and snippets.


Cullen Johnson cullenjohnson

View GitHub Profile
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:
View FilterSelectView.js
* FilterSelectView
* Creator: Cullen
FilterSelectView = Backbone.View.extend({
/** -----------------------------------
* ------------------------------------
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:
* Website:
* 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 / 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
/** $().flash(options)
* Author: Cullen Johnson
* URL:
* 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)