Skip to content

Instantly share code, notes, and snippets.

@lsmith
lsmith / gist:9868174
Last active August 29, 2015 13:57 — forked from jshirley/gist:9863326

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?

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 December 23, 2015 16:49
Custom event hacked up to support defaultFn that can return a promise to delay after subscribers. POC, mostly untested, so YMMV.
/*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 September 4, 2013 18:13
Adds a `Y.DOM.formToObject(identifier)` method.
/**
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 August 30, 2013 18:41
Fix for a bug in YUI 3 focus synthetic event when e.stopPropagation() is called between two delegate subscribers. Fix is on line 218.
/**
* Adds bubbling and delegation support to DOM events focus and blur.
*
* @module event
* @submodule event-focus
*/
var Event = Y.Event,
YLang = Y.Lang,
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;
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?
_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;
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) {
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') + '$');
}