Skip to content

Instantly share code, notes, and snippets.

@Foodguru
Foodguru / stringFormat.js
Created November 3, 2012 12:43 — forked from tonyto/stringFormat.js
javascript: String Format
String.prototype.format = function() {
var formatted = this;
for (var i = 0; i < arguments.length; i++) {
var regexp = new RegExp('\\{'+i+'\\}', 'gi');
formatted = formatted.replace(regexp, arguments[i]);
}
return formatted;
};
@Foodguru
Foodguru / edit.html.mustache
Created October 24, 2012 01:30 — forked from dbi/edit.html.mustache
Rails form helper for mustache spike/proof of concept
<!-- A scaffolded edit view converted to mustache -->
<h1>Editing post</h1>
{{#form}}
{{#errors?}}
<div id="error_explanation">
<h2>{{error_header}}</h2>
</div>
<ul>
@Foodguru
Foodguru / jquery.textchange.js
Created October 7, 2012 20:40 — forked from mkelly12/jquery.textchange.js
Javascript: Textchange with timeout
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {