This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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: | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }) |
OlderNewer