Skip to content

Instantly share code, notes, and snippets.

# YUI3 Snippets file for Vim SnipMate plugin
# http://www.vim.org/scripts/script.php?script_id=2540
# File Format should be simlar to TextMate
# Filetype option in VIM should be set to javascript.yui3
# YUI use block
snippet yui
YUI().use(${1}, function(Y) {
${2}
});
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<Script src="http://yui.yahooapis.com/3.1.0/build/yui/yui-min.js"></script>
</head>
<body>
<script>
alert('foo');
YUI({
//Last Gallery Build of this module
.program $assert:areEqual
if (length(args) < 2)
notify(#3, "Not enough Args");
raise(E_ARGS);
endif
msg = "";
{a, b, ?msg} = args;
notify(#3, tostr("a = ", a));
notify(#3, tostr("b = ", b));
notify(#3, tostr("msg = ", msg));
for x in ($goal_db:all_entries())
row = $goal_db:find_exact(x);
temp = {};
index = length(row);
starttime = time() - 432000;
while (index > 0 && row[index][1] > starttime )
temp = listappend(temp, row);
index = index - 1;
endwhile
"At this point, temp contains all the entries for player X made in the last 5 days.";
var YUI = require("yui3").YUI
, otherSuite = require("./other_suite")
;
YUI({logInclude:{TestRunner:true}}).use("test", function(Y) {
var suite = new Y.Test.Suite("Server Test Suite");
var test_nothing = new Y.Test.Case({
name: "Testing nothing",
"testing nothing special": function() {
@foxxtrot
foxxtrot / Chart Test
Created December 13, 2010 20:32
Testing YUI3 Charts for a Blog Post, multiple Charts on one document.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Charts Test</title>
<style type="text/css">
body { width: 755px; }
.chartContainer { clear: both; }
.yui3-cartesianchart { float: left; }
.chartLegend { float: right; width: 225px; border-style: groove; padding: 3px;}
.chartLegend ul { list-style-type: none; padding: 0;}
.chartLegend li { padding-left: 8px; }
#!/bin/bash
jsfile=${1};
testruns=1000
yuicompressor=./yuicompressor-2.4.5pre.jar;
yuicompressorServer="curl --silent http://localhost:8888/compress?type=js -T";
closurecompiler="./gcj.jar --compilation_level SIMPLE_OPTIMIZATIONS --js";
uglifyjs="uglifyjs";
echo "Running Compressor Tests on ${jsfile}...";
Buildfile: /home/craig/src/yui/yui3-gallery/src/gallery-node-extras/build.xml
[echo] Starting Build For gallery-node-extras
[echo] Ant Properties
[echo] Home : /usr/share/ant
[echo] Ant Version : Apache Ant version 1.8.0 compiled on May 9 2010
[echo] Build File : /home/craig/src/yui/yui3-gallery/src/gallery-node-extras/build.xml
[echo] Local Build Properties
[echo] version : 3
[echo] srcdir : /home/craig/src/yui/yui3-gallery
[echo] builddir : ../../../builder/componentbuild
SCANNING PSR X0392-15 AT 5.534417156693186 SAMPLES PER SECOND
-------------------------------------------------------------------------------
#INSUFFICIENT POWER 29.98%
#INSUFFICIENT POWER 30.39%
#INSUFFICIENT POWER 30.04%
#INSUFFICIENT POWER 29.22%
#INSUFFICIENT POWER 29.22%
#INSUFFICIENT POWER 29.20%
#INSUFFICIENT POWER 29.24%
#INSUFFICIENT POWER 29.23%
@foxxtrot
foxxtrot / gist:4962025
Last active December 13, 2015 19:19
A way to override the Gallery location in YUI. This is awful, but it works by overriding the defaults on all future YUI instances. You're better off applying it in the config object to YUI() or your YUI_config.
// YUI.Env is not populated until you build a YUI base object once. You can cache a reference to it here, if you'd like,
// but you probably don't want to require anything. You certainly don't want to require anything from the Gallery.
YUI()
YUI.Env[YUI.version].groups.gallery.base = "http://path.to.my.server/lib/yui-gallery/build";
YUI.Env[YUI.version].groups.gallery.comboBase = "http://path.to.my.server/combo?
YUI.Env[YUI.version].groups.gallery.root = "lib/yui-gallery/build";
// This is how you *should* do this, ignore everything above:
YUI({groups: { gallery: { base: "http://path.to.my.server/lib/yui-gallery/build", comboBase: "http://path.to.my.server/combo?", root: "lib/yui-gallery/build" } } });