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
@triptych
triptych / gist:1124201
Created August 4, 2011 00:07 — forked from ericf/gist:961730
A simple, small, and powerful CSS Grid System (based on YUI 3 CSS Grids)
/* Based on YUI 3 CSS Grids: http://developer.yahoo.com/yui/3/cssgrids/ */
.layout {
letter-spacing: -0.31em; /* webkit: collapse white-space between units */
*letter-spacing: normal; /* reset IE < 8 */
word-spacing: -0.43em; /* IE < 8 && gecko: collapse white-space between units */
}
.layout > *,
.layout .unit {
display: inline-block;
zoom: 1; *display: inline; /* IE < 8: fake inline-block */
// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}
// 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, [], {
// 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;
};
@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
@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 / 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 / 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: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 / 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.
});