Skip to content

Instantly share code, notes, and snippets.

View davglass's full-sized avatar
💭
Taking a much needed sabbatical from Open Source. Please fork and carry on.

Dav Glass davglass

💭
Taking a much needed sabbatical from Open Source. Please fork and carry on.
View GitHub Profile
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 })
@davglass
davglass / .gitignore
Created October 12, 2012 21:50 — forked from caridy/m.js
node_modules
@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>
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",
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);
<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:
//
if(typeof (console) == 'undefined') {var console={init:function(){console.d=document.createElement('div');document.body.appendChild(console.d);var a=document.createElement('a');a.href='javascript:console.hide()';a.innerHTML='close';console.d.appendChild(a);var a=document.createElement('a');a.href='javascript:console.clear();';a.innerHTML='clear';console.d.appendChild(a);var id='fauxconsole';if(!document.getElementById(id)){console.d.id=id;}console.hide();},hide:function(){console.d.style.display='none';},show:function(){console.d.style.display='block';},log:function(o){console.d.innerHTML+='<br/>'+o;console.show();},clear:function(){console.d.parentNode.removeChild(console.d);console.init();console.show();}};console.init();}
var bagger___start = function() {
// --- Bagger code
void(function() {
BaggerYUI().use('node', 'io-xdr', 'overlay', 'dd', 'json', function(Y) {
@davglass
davglass / server.js
Created November 19, 2010 12:52 — forked from darkhelmet/server.js
var http = require('http'),
sys = require('sys'),
fs = require('fs'),
url = require('url'),
queryString = require('querystring'),
proxy = require('./htmlfiltre'),
YUI = require('yui3').YUI;
http.createServer(function(req, res) {
proxy.htmlFiltre(req, { foreignHost: 'www.instapaper.com', foreignHostPort: 80 }, function (status, buffer, request, response, loc) {
var path = require('path'),
fs = require('fs'),
express = require('express'),
YUI = require('yui3').YUI;
var app = module.exports = express.createServer();
YUI({
debug: true
}).use('dump', 'node', 'express', function(Y){
YUI().use('event', 'node', function(Y) {
Y.on('domready', cascadeFields);
function unhide(cl) {
//CHANGED
Y.all('#mortgage_picker_form select.' + cl).setStyle('display', 'block');
}
function hide(cl) {
//CHANGED