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
  • 10:57 (UTC -07:00)
View GitHub Profile
@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 () {
@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 / setbodyheight.js
Created November 6, 2010 06:14
How to set the <body> tag's height to the full window height and still get it right on the iPhone.
window.onload = function () {
var s = document.body.style;
s.height = window.screen.availHeight + 'px';
setTimeout(function () {
window.scrollTo(0, 0);
s.height = window.innerHeight + 'px';
}, 50);
};
@ryanflorence
ryanflorence / static_server.js
Last active February 27, 2025 06:28
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@kara-ryli
kara-ryli / yui3-serialize-form.js
Created February 18, 2011 02:26
Serialize a form into a query string with YUI3
YUI().use('node', 'array-extras', 'querystring-stringify', function (Y) {
var form = Y.one('FORM_SELECTOR'), query;
query = Y.QueryString.stringify(Y.Array.reduce(Y.one(form).all('input[name],select[name],textarea[name]')._nodes, {}, function (init, el, index, array) {
init[el.name] = el.value;
return init;
}));
console.log(query);
});
@nathansmith
nathansmith / web-design-development-learning-resources.md
Last active October 12, 2024 17:08
Resources for learning web design & front-end development
@robflaherty
robflaherty / gist:1129904
Created August 7, 2011 00:00
Stylus conversion of Normalize.css
/*
* Normalize.css converted to Stylus
* http://github.com/necolas/normalize.css
*/
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section
display: block
audio, canvas, video
display: inline-block
@tbranyen
tbranyen / app.js
Created September 22, 2011 16:51
backbone.js sub routing
/* Pretend app setup stuff is here */
/* Kick off app */
jQuery(function($) {
var Gallery = app.module("gallery");
app.Router = Backbone.Router.extend({
initialize: function() {
this.gallery = new Gallery.Router("gallery/");
@domi-papin
domi-papin / jquery-ui-draggable-touch-support
Created January 2, 2012 14:39
Add touch event support to jquery ui draggables AND faster clicks on touch devices as a bonus
/*
* picked from http://stackoverflow.com/questions/5186441/javascript-drag-and-drop-for-touch-devices
*
*/
function touchHandler(event)
{
// trick to add support for touch event to elements/widgets that do not support it
// by convetting convert touchevents into mouseevents
// only apply this trick to ui-draggable elements
@nathansmith
nathansmith / 1_form-reset.scss
Last active September 8, 2019 09:33
Form Reset
// `Default font for form elements.
//----------------------------------------------------------------------------------------------------
$form-font-stack: Arial, "Liberation Sans", FreeSans, sans-serif !default;
$form-font-size: 13px !default;
// `Form Element Reset.
//----------------------------------------------------------------------------------------------------
input::ms-clear,