Skip to content

Instantly share code, notes, and snippets.

View triptych's full-sized avatar
💭
Making web things

Andrew Wooldridge triptych

💭
Making web things
View GitHub Profile
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Basic Object Behavior</title>
<script src='js/Box2dWeb-2.1.a.3.js'></script>
<script src='js/example.js'></script>
<style> canavs { background-color:black; } </style>
</head>
<body>
YUI({
modules: {
'module1': {
path: 'path/to/module1.js',
requires: ['modules', 'this', 'requires']
}
}
}).use('node', function(Y) {
//module1 is not loaded
@triptych
triptych / promises.md
Created October 20, 2012 16:59 — forked from domenic/promises.md
You're Missing the Point of Promises

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
    // the rest of your code goes here.
});
@triptych
triptych / gist:3814248
Created October 1, 2012 20:32 — forked from hatched/gist:3814136
ADd placeholder support to old browsers
YUI.add('placeholder', function(Y) {
var VALUE = 'value',
PLACEHOLDER = 'placeholder',
elements = {},
events = [];
/*
* The sync method allows you to add additional inputs to the page and then resync the placeholders
*/
@triptych
triptych / gist:3764195
Created September 21, 2012 22:01 — forked from juandopazo/gist:1161269
YUI Boilerplate?
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/combo?3.4.0/build/cssreset/cssreset-min.css&
3.4.0/build/cssfonts/cssfonts-min.css&3.4.0/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<script src="http://yui.yahooapis.com/3.4.0/build/yui/yui-min.js"></script>
@triptych
triptych / gist:3147448
Created July 19, 2012 22:58 — forked from gom/gist:1126857
Unicode escape / unescape on javascript via http://d.hatena.ne.jp/sawat/20070309/1173459459
var unicode = {
escape: function(s) {
return s.replace(/^[-~]|\\/g, function(m) {
var code = m.charCodeAt(0);
return '\\u' + ((code < 0x10) ? '000' : ((code < 0x100) ? '00' : ((code < 0x1000) ? '0' : ''))) + code.toString(16);
});
},
unescape : function (s) {
return s.replace(/\\u([a-fA-F0-9]{4})/g, function(matched, g1) {
return String.fromCharCode(parseInt(g1, 16))
@triptych
triptych / dabblet.css
Created March 19, 2012 22:21 — forked from JoelBesada/dabblet.css
CSS States
/* CSS States */
body {
background: url(http://dabblet.com/img/noise.png);
background-color: #F5F2F0;
font-family: Georgia, serif;
font-size: 18px;
line-height: 1.6em;
text-shadow: 0 2px 0 white;
color: #222;
}
@triptych
triptych / yui3-string-utils.js
Created February 21, 2012 18:01 — forked from erikeldridge/yui3-string-utils.js
a YUI 3 module for string utilities
// a YUI 3 module for string utilities
// ref: http://developer.yahoo.com/yui/3/yui/#yuiadd
YUI.add( 'string', function(Y) {
// parseUri 1.2.2
// (c) Steven Levithan <stevenlevithan.com>
// MIT License
// Source: http://stevenlevithan.com/demo/parseuri/js/assets/parseuri.js
// Retrieved: 5/10/10
// Creates a new App and View instance.
var app = new Y.App(),
view = new Y.View();
// Overrides the view's `render()` method to render text into its `container`.
view.render = function () {
this.get('container').set('text', 'Hello World!');
return this;
};
// Creates a Person model which has a `name` attribute.
Y.Person = Y.Base.create('person', Y.Model, [], {}, {
ATTRS: {
name: {}
}
});
// Creates a HelloView which can say hello to a Person, or to the World if a
// Person model is not specified.
Y.HelloView = Y.Base.create('helloView', Y.View, [], {