Skip to content

Instantly share code, notes, and snippets.

View evocateur's full-sized avatar

Daniel Stockman evocateur

View GitHub Profile
@evocateur
evocateur / gist:5531
Created August 15, 2008 03:39
my ~/.profile
# my ~/.profile
# somewhat mac-specific, lots of git aliases
# functionName () { do something $@<-arguments ; }
function ls { command ls -1AGp "$@"; }
# 'command ls' to prevent loop; -A for .file, -F for dir/ link@,
# -h for 5k 3m 1g, -o for printing flags (uchg)...
function l { ls -lhog "$@"; } # -l to list in long format...
function ll { ls -lF "$@" | less -XF ; } # pipe into 'more'
@evocateur
evocateur / fixconsolas
Created March 15, 2009 00:15
Fix Consolas's line-height on OS X
#!/bin/bash
#
# Requires ftxdumperfuser from http://developer.apple.com/textfonts/download/
#
# Usage: fixconsolas [files ...]
# When called with no arguments, it attempts to operate on every TrueType
# file in the current directory.
#
# References:
# http://bandes-storch.net/blog/2008/12/21/consolas-controlled/#comment-2042
var escapeHTML = function(s) {
return s.replace(
/([<>&""''])/g,
function(m, c) {
switch(c) {
case "<": return "&lt;";
case ">": return "&gt;";
case "&": return "&amp;";
case '"': return "&quot;";
case "'": return "&apos;";
@evocateur
evocateur / install_node-v0.4.12.sh
Created December 20, 2011 01:36
A script to install nodejs v0.4.12 on Ubuntu
#!/bin/sh
apt-get -y update
apt-get -y install libssl-dev git-core pkg-config build-essential curl gcc g++
mkdir /tmp/node-install
cd /tmp/node-install
wget http://nodejs.org/dist/node-v0.4.12.tar.gz
tar -zxf node-v0.4.12.tar.gz
YUI.add('node-scroll-info', function (Y) {
/**
Provides the ScrollInfo Node plugin, which exposes convenient events and methods
related to scrolling.
@module node-scroll-info
**/
/**
@evocateur
evocateur / z-aliased-attr-test.html
Created November 6, 2012 18:57
Aliased Attribute Extension
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="ie ie8" lang="en"> <![endif]-->
<!--[if gte IE 9]> <html class="ie" lang="en"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>z-aliased-attr Test Suite</title>
@evocateur
evocateur / gist:5017874
Last active December 14, 2015 02:59 — forked from ericf/gist:5015971
A script to include or exclude YUI modules based on their node.js compatibility.
#!/usr/bin/env node
var fs = require('fs'),
path = require('path'),
yui_module = process.argv[2] ? path.join(process.cwd(), process.argv[2]) : 'yui',
output = process.argv[3],
EXCLUDE_FILTERS = [
/^cookie/,
grunt.initConfig({
// Runs the YUI3 build tool on a directory. Docs: <http://yui.github.io/shifter/>
"shifter": {
"crm-src": {
// (optional) version - What to fill in on the "@VERSION@" field in built files
"version": "CRM",
// (optional) lint can be 'config' or false
// if "config", shifter will use the nearest .jshintrc JSON file as JSHint config
// if "false", shifter will skip the lint step entirely.
"lint" : "config",
/*jslint node:true, forin:true */
module.exports = function (grunt) {
var path = require('path'),
isArray = Array.isArray,
template = 'ddc.utils.namespace("ddc.crm.modules.crm", <%= JSON.stringify(modules) %>);';
grunt.registerMultiTask('build-config', 'Build the YUI config files', function () {
var data = this.data,
envs = data.envs,

Parent/Child Y.Views

As I worked with Y.App it became clear that while Y.View is a great abstraction it would be easy to overwhelm a single instance with way too much functionality. This is my attempt to solve that issue by allowing multiple child views to be attached to a single parent view via an extension.

Usage

The extension is mixed into the parent view like any other extension using Y.Base.create.

var Parent = Y.Base.create("view", Y.View, [