Skip to content

Instantly share code, notes, and snippets.

View stlsmiths's full-sized avatar
🎯
Focusing

Todd Smith stlsmiths

🎯
Focusing
View GitHub Profile
@stlsmiths
stlsmiths / parser.js
Created June 10, 2011 20:09
A great JS formula parser - this is a fork
/*
Based on ndef.parser, by Raphael Graf(r@undefined.ch)
http://www.undefined.ch/mparser/index.html
Website http://silentmatt.com/javascript-expression-evaluator/
*/
// Added by TES 6/13/2011
// re-define indexOf, because IE doesn't know it ...
// from http://stellapower.net/content/javascript-support-and-arrayindexof-ie
// showEditor
oe.showEditor(td6);
inp = oe._inputNode;
// ESC cancelEditor
td6.simulate('click');
//inp.focus();
inp.simulate('keypress',{charCode:72}); // 4:52 H:72 i:105
inp.simulate('keypress',{charCode:52}); // 4:52 H:72 i:105
inp.simulate('keydown',{keyCode:27});
@stlsmiths
stlsmiths / gist:4536300
Created January 15, 2013 05:12
yogi nodejs stack dump
todds-Mac-Pro:gallery-datatable-contextmenu todd$ ll
total 40
drwxr-xr-x 14 todd staff 476 Jan 14 22:58 ./
drwxr-xr-x 14 todd staff 476 Jan 14 01:52 ../
drwxr-xr-x 10 todd staff 340 Jan 14 23:06 .git/
-rw-r--r-- 1 todd staff 146 Jan 14 09:21 HISTORY.md
-rw-r--r-- 1 todd staff 518 Jan 14 14:44 README.md
drwxr-xr-x 4 todd staff 136 Jan 14 14:20 assets/
-rw-r--r-- 1 todd staff 262 Jan 14 14:21 build.json
-rw-r--r-- 1 todd staff 659 Jan 14 01:54 build.properties
<!doctype html>
<html>
<head>
<title>gallery-datatable-popup</title>
<script src="/build/yui/yui.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="dtable"></div>
<div id="logger"></div>
BaseView = Y.Base.create('baseview', Y.View,[],{
//
// my awesome BaseView statics and methods
//
},{
ATTRS:{
//
// my awesome BaseView ATTRS
//
}
@stlsmiths
stlsmiths / gist:4401054
Created December 28, 2012 19:23
YUI3 DT column formatter for HTML "link"
/**
This assumes you have "data" with the following "keys" defined,
customer_id, customer_name, carrier_name, carrier_id
It defines an HTML template as the base link HTML and uses a
YUI3 substitution function (Y.Lang.sub) to safely replace the
tokens within the htmlTMPL.
You must have "allowHTML:true" set for this to work properly.
// if you're using DataSource.IO see http://yuilibrary.com/yui/docs/api/classes/DataSource.IO.html#event_response
// if you're using DataSource.Get see http://yuilibrary.com/yui/docs/api/classes/DataSource.Get.html#event_response
// listen for the DS response as ....
myYUI3DataSource.after('response', function(o) {
/* the response object contains the following;
o.response.meta, = meta fields parsed from the DataSchema "metaFields"
@stlsmiths
stlsmiths / gist:4367514
Created December 24, 2012 04:22
Overriding paginatorDSRequest to add extra stuff ...
//
var dt = new Y.DataTable({
columns: ...
paginator: .....
requestStringTemplate: "?page={page}&itemsPerPage={itemsPerPage}&sortBy={sortBy}" // or whatever
});
@stlsmiths
stlsmiths / gist:4155407
Created November 27, 2012 16:47
Creating a View instance to wrap a Popup Calendar in an Overlay
//
// Double-click on a cell in last column "Trans Date", opens a pop-up Calendar
// in an Overlay
// http://www.blunderalong.com/yui/dta/editing/dt_cellediting.html
PopupCalView = Y.Base.create('popupCal',Y.View,[],{
// Setup static properties to hold instances of Overlay and Calendar
_overlay: null,
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>DT Destroy</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body class="yui3-skin-sam">
<button id="btnRebuild">Rebuild it!</button>
<button id="btnDestroy">Destroy it!</button>