Skip to content

Instantly share code, notes, and snippets.

/*
* An example of
* 1. Using the YUI 3 module system to encapsulate a custom class for reuse
* 2. Creating a Plugin class
* 3. Using Y.Base.create to generate the class
*/
// YUI.add(
// "dash-separated-module-name",
// function (Y) { Y.MyModule = ...; },
<?php header('HTTP/1.0 500 Internal Server Error'); exit; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.8.0/build/reset-fonts-grids/reset-fonts-grids.css&2.8.0/build/base/base-min.css">
</head>
<body class="yui-skin-sam">
<div id="doc" class="yui-t7">
@HenrikJoreteg
HenrikJoreteg / JS Util solution using underscore.js
Created October 22, 2010 21:20
Rather than creating some other util global, just extend underscore.js with any additional methods you want.
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/)
// Then, use underscore's mixin method to extend it with all your other utility methods
// like so:
_.mixin({
escapeHtml: function () {
return this.replace(/&/g,'&amp;')
.replace(/>/g,'&gt;')
.replace(/</g,'&lt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');
@zerok
zerok / couch_backup.py
Created October 23, 2010 12:23
A simple backup script for couchdbs
"""
Copyright (c) 2010, Horst Gutmann <zerok@zerokspot.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
@kara-ryli
kara-ryli / yui.loader.js
Created February 11, 2011 22:21
The many ways to manage dependencies in YUI3
// Add modules globally
(function () {
var cfg = window.YUI_config || {};
cfg.modules = cfg.modules || {};
// Add external dependencies
cfg.modules.externalDependency = {
fullpath: '/path/to/script.js',
requires: ['node', 'event']
/*
* Customize Footnotify on your site by adding custom css.
*
* This file is NOT loaded by the script and must be
* implemented on the site in order to apply.
*
* More info: https://gist.github.com/1046538
*
*/
@yko
yko / debug-demo.psgi
Created July 12, 2011 08:55
PSGI Hello World with Plack Debug middleware
#!/usr/bin/env perl
use strict;
use warnings;
use Plack::Builder;
my $body = join '', <DATA>;
my $app = sub {
my $self = shift;
@yko
yko / idebug-demo.psgi
Created July 12, 2011 10:17
PSGI InteractiveDebugger demo
#!/usr/bin/env perl
use strict;
use warnings;
use Plack::Builder;
my $body = join '', <DATA>;
my $app = sub {
my $self = shift;
@kwhinnery
kwhinnery / Person.js
Created July 19, 2011 22:52
Monkey patch for require in Titanium Mobile
exports.Person = function(firstName,lastName) {
this.firstName = firstName;
this.lastName = lastName;
};