Skip to content

Instantly share code, notes, and snippets.

View davglass's full-sized avatar

Dav Glass davglass

  • Fingerprint
  • Marion, IL
  • 22:19 (UTC -05:00)
View GitHub Profile
<html>
<head>
<title>Chapter 6 Section 4, Pro JavaScript Design Patterns</title>
</head>
<body>
<script>
// this is straight from the code exampes at http://jsdesignpatterns.com/
// sadly, it fails with a syntax error. quoth JSLint:
//
var YUI = require('yui3').YUI,
fs = require('fs');
var filename = 'foo.html';
var result = fs.readFileSync(filename, "utf8");
YUI({loadOptional: true}).use('node', function(Y) {
Y.one('doc').set('innerHTML', result);
Y.config.base = YUI.config.base || Y.Env.getBase(Y.Env._BASE_RE);
// Regex in English:
// I'll start at the \b(simpleyui).
// 1. Look in the test string for "simpleyui" or "yui" or
// "yui-base" or "yui-rls" or "yui-foobar" that comes after a word break. That is, it
// can't match "foyui" or "i_heart_simpleyui". This can be anywhere in the string.
// 2. After #1 must come a forward slash followed by the string matched in #1, so
// "yui-base/yui-base" or "simpleyui/simpleyui" or "yui-pants/yui-pants".
// 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min",
@davglass
davglass / loader_attempted.html
Created November 28, 2011 15:59
YUI3 ticket 2531319 repro
<html>
<body>
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/yui-core/yui-core.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/oop/oop.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/event-base/event-base.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/event-custom-base/event-custom-base.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/event-custom-complex/event-custom-complex.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/attribute-base/attribute-base.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/attribute-complex/attribute-complex.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/get/get.js"></script>
@davglass
davglass / .gitignore
Created October 12, 2012 21:50 — forked from caridy/m.js
node_modules
var svgLine = require('svg-line')
var raf = require('raf')
var ns = 'http://www.w3.org/2000/svg'
var tau = Math.PI * 2
var svg = document.createElementNS(ns, 'svg')
var line = document.createElementNS(ns, 'path')
var points = []
var path = svgLine()
.x(function(d) { return d.x })