Skip to content

Instantly share code, notes, and snippets.

View ericf's full-sized avatar

Eric Ferraiuolo ericf

View GitHub Profile
{
"name": "YUIDoc",
"description": "YUIDoc documentation tool written in Javascript",
"version": "0.1.0",
"url": "http://yuilibrary.com/projects/yuidoc",
"options": {
"external": {
"data": "http://yuilibrary.com/yui/docs/api/data.json"
},
"linkNatives": "true",
@rgrove
rgrove / gist:2025242
Created March 12, 2012 22:56
YUI Attribute Value Filters proposal

Attribute Value Filters

With more and more application logic moving to the client, and with YUI becoming more popular on the server, it's increasingly important to design APIs that handle user input safely. Currently, YUI modules that store user input in attributes must do one of two things: either escape user strings before setting an attribute, or escape them manually before using them.

Escaping automatically before storing the value is safest, but also inconvenient if you sometimes need the unescaped value, since you must then store two versions (probably in two different attributes). This can lead to API clutter and confusion. Escaping manually before use avoids API clutter but increases the likelihood of mistakes, and also clutters up the codebase in general. It significantly increases the chances that another developer who is unaware of the need to escape the value will inadvertently introduce a security vulnerability.

Proposal

Attribute should provide a consistent, pluggable API for retrieving

@zachleat
zachleat / gist:2008932
Created March 9, 2012 21:56
Prevent zoom on focus
// * iOS zooms on form element focus. This script prevents that behavior.
// * <meta name="viewport" content="width=device-width,initial-scale=1">
// If you dynamically add a maximum-scale where no default exists,
// the value persists on the page even after removed from viewport.content.
// So if no maximum-scale is set, adds maximum-scale=10 on blur.
// If maximum-scale is set, reuses that original value.
// * <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=2.0,maximum-scale=1.0">
// second maximum-scale declaration will take precedence.
// * Will respect original maximum-scale, if set.
// * Works with int or float scale values.
@rgrove
rgrove / .jshint.json
Created March 7, 2012 19:09
JSHint build file for SublimeText 2
{
// enforcing options (true means potentially more warnings)
"adsafe": false, // true if ADsafe rules should be enforced. See http://www.ADsafe.org/
"bitwise": true, // true if bitwise operators should not be allowed
"curly": true, // true if curly braces should be required around blocks in loops and conditionals
"eqeqeq": true, // true if === should be required (for ALL equality comparisons)
"forin": false, // true if unfiltered 'for in' statements should be forbidden
"immed": true, // true if immediate function invocations must be wrapped in parens
"newcap": true, // true if Initial Caps must be used with constructor functions
@rgrove
rgrove / app.js
Created February 24, 2012 20:57
Simple Handlebars view engine for Express
var express = require('express'),
app = express.createServer();
app.configure(function () {
// Use our custom Handlebars-based view engine as the default.
app.register('.handlebars', require('./view'));
app.set('view engine', 'handlebars');
// ...
});
@Satyam
Satyam / gist:1547708
Created January 1, 2012 16:28
App plugin
/*
App plugins can be loaded over an instance of App by setting a route with a wildcard path
such as:
{
path:'/:app/*',
callback: 'dispatchApp'
}
where the app param is the module name of the plugin,
which should have its entry in the YUI config file (unless loaded by some other means)
*/
@sdesai
sdesai / gist:1386836
Created November 22, 2011 20:28
WidgetStringRenderer

USE CASES

  • Render widgets on NodeJS, where DOM is absent.
  • Optimize rendering of Widgets at scale (1000s of TreeViewNodes).

GOAL

  • Avoid all Node references from Widget through the end of renderUI().
  • bindUI()/syncUI() will still have Node references (to bind events and incrementally update DOM).
RED="\[\033[1;31m\]"
YELLOW="\[\033[1;33m\]"
GREEN="\[\033[1;32m\]"
BLUE="\[\033[1;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[1;37m\]"
COLOR_NONE="\[\e[0m\]"
@rgrove
rgrove / delete-tags.sh
Created August 7, 2011 21:42
Shell script to delete useless build tags from GitHub forks of YUI 3
#!/bin/bash
# This script will delete *all* local and remote tags from any git repo you run
# it in, unless they begin with "v". Please use it to remove the hundreds of
# build tags from your YUI 3 fork.
#
# This script will not delete branches; just tags.
set -e
@lsmith
lsmith / gist:1097943
Created July 21, 2011 19:07
Make Y.DataTable instantiable, and an extension point for feature extension classes
// Right now, Y.DataTable is only a namespace. But I want to be able to say new Y.DataTable({...});
// We can do it. We have the technology.
// Step 1. Capture all the properties of the Y.DataTable namespace
// Y.merge creates a shallow copy of an object, and since Y.DataTable is just a namespace object,
// this works like a champ. You could now say new Stuff.Base({...}) to create a DataTable.Base
// instance.
var Stuff = Y.merge(Y.DataTable);
// Step 2. Replace the Y.DataTable namespace with a working DataTable.Base subclass