Skip to content

Instantly share code, notes, and snippets.

YUI().use(
"console",
"file1",
"file2",
function (Y) {
// I'm a callback that runs as soon as all dependencies are loaded
}
);
YUI.add(
YUI().use(
"console",
"ep-ui-builder",
function (Y) {
Y.on(
"domready",
function () {
Y.log("index - building UI");
try {
Y.EP.UI.Build ();
@brianjmiller
brianjmiller / gist:1782297
Created February 9, 2012 19:35
YUI: Building a select
_uiSetSuppliers: function (value, src) {
Y.log(Clazz.NAME + "::_uiSetSuppliers");
if (this._supplierSelectNode) {
this._supplierSelectNode.empty();
this._supplierSelectNode.append('<option value="">' + this.get("strings").choose_one_option_label + '</option>');
if (this.get("suppliers")) {
this.get("suppliers").each(
function (supplier) {
this.append('<option value="' + supplier.get("id") + '">' + supplier.get("display_label") + '</option>');
@brianjmiller
brianjmiller / gist:1717901
Created February 1, 2012 16:35
Selects with date
var selected_date = e.newSelection[0];
var selected_month = selected_date.getMonth();
this._calendarNavGoToDateMonthSelectNode.set("selectedIndex", selected_month);
var selected_day = selected_date.getDate();
this._calendarNavGoToDateDaySelectNode.set("selectedIndex", selected_day - 1);
var selected_year = String(selected_date.getFullYear());
this._calendarNavGoToDateYearSelectNode.all("option").each(
@brianjmiller
brianjmiller / gist:1678212
Created January 25, 2012 19:52
data extraction using HTML::DOM
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use DBI;
use HTML::DOM;
my $dbh = DBI->connect(
'dbi:mysql:dbname=...;host=localhost;sslmode=disable',
@brianjmiller
brianjmiller / gist:1540779
Created December 30, 2011 17:49
YUI: Single Template
YUI.add(
"ep-w-work_entry-base",
function (Y) {
var UI = Y.Widget.UI_SRC;
var MODE = "Mode";
var STATUS = "Status";
var WC_AC_SOURCE = "WorkChart/ac?";
var Clazz = Y.namespace("EP.W.WorkEntry").Base = Y.Base.create(
@brianjmiller
brianjmiller / gist:1443182
Created December 7, 2011 15:18
Use of MakeNode
YUI.add(
"ep-w-work_entry-duration-base",
function (Y) {
var Clazz = Y.namespace("EP.W.WorkEntry.Duration").Base = Y.Base.create(
"ep-w-work_entry-duration-base",
Y.Widget,
[ Y.MakeNode, Y.IC.ModelConsumer ],
{
BOUNDING_TEMPLATE: '<tr></tr>',
CONTENT_TEMPLATE: null,
@brianjmiller
brianjmiller / gist:1423598
Created December 2, 2011 15:15
get_subtree subroutine
sub get_subtree {
my ($self, %opt) = @_;
my (@load, %referents, @top_nodes, @tree, %map, $db, $nodes);
$nodes = delete $opt{work_chart_nodes};
$db = $opt{db} || $self->init_db;
%map = map {
$_->db( undef );
$_->children( [] );
@brianjmiller
brianjmiller / gist:1295327
Created October 18, 2011 12:43
Failing Y.MakeNode template snippet
{? {n @ model @ id} {n @ model @ id} "<select class={c supplierSelect}><option value=>{s choose_one_option_label}</option></select>"}
@brianjmiller
brianjmiller / gist:1282603
Created October 12, 2011 21:14
toJSON and mlClass attribute properties
// use as follows (can be combined)
{
ATTRS: {
total: { value: 0, toJSON: false },
lines: { value: null, setter: '_setML', mlClass: Y.App.Manage.ML.Lines }
}
}
// base class definition