Skip to content

Instantly share code, notes, and snippets.

Luke Smith lsmith

Block or report user

Report or block lsmith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9868174

Leveraging Technology to Increase Pain of Paying, and Improve Personal Savings

As technology advances, p_P_eople are getting further from the hard concept of money. Without seeing immediate feedback, people repeat undesiredby whom? behaviors without having any painbetter word?. The tendency to repeat previous behaviors without thinking of the original motivation has been observed (Ariely, D. & Norton, M. I., 2008)footnote?. This behavior may cause repeatedmay increase purchases without adequatewith inadequate? deliberate decision-makingdeliberation?.

This problem is exacerbated by the reduction of the pain of paying as the distance from physical currency increases (Ariely and Silva, 2002). We are increasingly moving towards electronic payments and this trend will not reverse (Borzekowski, Kiser, Ahmed, 2006).Isn't this correlating physical proximity with conceptual proximity?</su

View gist:6799794
YUITest.TestCase.prototype = {
// ...
wait: function (segment, timeout) {
var delay = (typeof segment === 'number') ? segment :
(typeof timeout === 'number') ? timeout :
YUITest.MAX_WAIT;
throw new YUITest.Wait((typeof segment === 'function' ? segment : YUITest._waitTimeout), delay);
},
@lsmith
lsmith / gist:6664382
Last active Dec 23, 2015
Custom event hacked up to support defaultFn that can return a promise to delay after subscribers. POC, mostly untested, so YMMV.
View gist:6664382
/*global SM:true*/
'use strict';
// Publish a very special, promise-compatible event that supports the default
// function behavior to chain on internally created promises before executing
// the after() subs. on() subs can still e.preventDefault(), which will
// reject the promise and thus skip the default behavior and after() subs.
var asyncEvent = eventTarget.publish('foo');
asyncEvent._firing = new Y.Promise(function (resolve) { resolve(); });
@lsmith
lsmith / gist:6440659
Created Sep 4, 2013
Adds a `Y.DOM.formToObject(identifier)` method.
View gist:6440659
/**
Adds a `Y.DOM.formToObject(identifier)` method to extract the values from a
`<form>` element and return an object map of element name to value(s).
@module dom
@submodule dom-form-values
@since @SINCE@
**/
var isArray = Y.Lang.isArray;
@lsmith
lsmith / gist:6393024
Created Aug 30, 2013
Fix for a bug in YUI 3 focus synthetic event when e.stopPropagation() is called between two delegate subscribers. Fix is on line 218.
View gist:6393024
/**
* Adds bubbling and delegation support to DOM events focus and blur.
*
* @module event
* @submodule event-focus
*/
var Event = Y.Event,
YLang = Y.Lang,
View gist:5986637
Notifier.prototype.fire = function () {
// first arg to delegate notifier should be an object with currentTarget
var args = toArray(arguments, 0, true),
handle = this.handle,
ce = handle.evt,
sub = handle.sub,
thisObj = sub.context,
delegate = sub.filter,
event = e || {},
ret;
View gist:5595595
var ops = [], i, len;
for (i = 0, len = models.length; i < len; ++i) {
ops.push(new Y.Promise(function (resolve, reject) {
Y.io('save-my-stuff.php', {
data: models[i].toJSON(),
on: {
success: function (id, xhr) {
// Maybe you want to JSON parse the responseText first?
// Maybe you don't care about the response beyond it being 200?
View gist:5536394
_toggleStripes: function (index) {
var task = this._toggleStripesTask,
self;
// index|0 to force int, avoid NaN. Math.max() to avoid neg indexes.
index = Math.max((index|0), 0);
if (!task) {
self = this;
View gist:5507579
lookup: function (col) {
var className = cName('lookup'),
lookup = col.lookupTable || {},
entries, i, len;
if (isArray(lookup)) {
entries = lookup;
lookup = {};
for (i = 0, len = entries.length; i < len; ++i) {
View gist:5417052
var buildParser = Y.cached(function (prefix, suffix, separator, decimal) {
var regexBits = []
regex;
if (prefix) {
regexBits.push('^' + prefix.replace(safeRegExp, '\\$1'));
}
if (suffix) {
regexBits.push(suffix.replace(safeRegExp, '\\$1') + '$');
}
You can’t perform that action at this time.