Skip to content

Instantly share code, notes, and snippets.

View mundizzle's full-sized avatar
🏠
Working from home

mundi morgado mundizzle

🏠
Working from home
  • Gierd
  • Oakland, CA
  • 04:12 (UTC -07:00)
View GitHub Profile
@HenrikJoreteg
HenrikJoreteg / JS Util solution using underscore.js
Created October 22, 2010 21:20
Rather than creating some other util global, just extend underscore.js with any additional methods you want.
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/)
// Then, use underscore's mixin method to extend it with all your other utility methods
// like so:
_.mixin({
escapeHtml: function () {
return this.replace(/&/g,'&')
.replace(/>/g,'>')
.replace(/</g,'&lt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');
@kara-ryli
kara-ryli / yui-widget-structure.js
Created October 13, 2010 17:46
Basic YUI Widget Structure.
/* global YUI */
YUI.add("my-module", function (Y) {
"use strict";
Y.MyWidget = Y.Base.create("my-module", Y.Widget, [], {
initializer: function () {
// publish any events
// do any instantiation that doesn't require DOM
},
renderUI: function () {