Skip to content

Instantly share code, notes, and snippets.

View ericf's full-sized avatar

Eric Ferraiuolo ericf

View GitHub Profile
// DOM API
var content = document.getElementById('content'),
p = document.createElement('p'),
a = document.createElement('a');
p.id = 'markout';
a.href = 'http://oddnut.com/markout/';
p.appendChild(a)
content.appendChild(p);
// Markout
var docFrag = Y.Markout(),
p, ul;
p = docFrag.p();
p.strong().text('MarkoutJS');
p.text(' - ');
p.a({ href: 'http://oddnut.com' }).text('Oddnut Software');
ul = docFrag.ul();
YUI({
"base": "http://local.oddnut.com:8080/yui3/_v_3.1.0.pr2/",
"comboBase": "http://local.oddnut.com:8080/yui3/_v_3.1.0.pr2/_combo?",
"root": "",
"combine": true,
"groups": {
"utils": {
"base": "http://local.oddnut.com:8080/utils/",
"comboBase": "http://local.oddnut.com:8080/utils/_combo?",
"root": "",
// ...
Y.extend(MyPage, Y.Base, {
components : {
myComponent : {
requires : ['overlay'],
initializer : '_initMyComponent'
}
},
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="http://yui.yahooapis.com/3.1.0/build/yui/yui-min.js"></script>
<script>
YUI().use('io',function(Y){
var ioConfig = {
Button = Y.Base.create('toolbar-button',Y.Widget,[Y.WidgetChild],{
BOUNDING_TEMPLATE : '<li/>',
CONTENT_TEMPLATE : '<button/>',
_clickHandle : null,
className : '',
initializer : function(config) {
this.className = this.getClassName();
},
Y.datauri('http://example.com/foo.png', function(fooDataURI){
Y.one('body').append(Y.Node.create('<img/>').set('src', fooDataURI));
});
Y.datauri('http://example.com/foo.png', 'http://example.com/bar.png', function(foo, bar){
});
Y.datauri(['http://example.com/foo.png', 'http://example.com/bar.png'], function(datauris){
// datauris is an array because array was passed in
<!DOCTYPE html>
<html>
<head>
<title>Fancy Overlay</title>
<style type="text/css">
.yui3-overlay {}
.yui3-overlay-content {
-webkit-border-radius: 3px;
YUI().use('base', 'gallery-resource', function(Y){
var MyClass, myClass, resource;
// MyClass Def
MyClass = function (config) {
MyClass.superclass.constructor.apply(this, arguments);
};
YUI().use('widget', function(Y){
var widget = new Y.Widget();
widget.addAttr('type');
widget.after('typeChange', function(e){
this.get('boundingBox').replaceClass(this.getClassName(e.prevVal), this.getClassName(e.newVal);
});
widget.set('type', 'alert');