Skip to content

Instantly share code, notes, and snippets.

View runspired's full-sized avatar
💜
Pondering Paradigms

Chris Thoburn runspired

💜
Pondering Paradigms
View GitHub Profile
/*jshint eqeqeq:false */
/**
* Provides A base view for building select like objects.
*/
/*global Nexus, Ember, Utils*/
(function () {
"use strict";
@runspired
runspired / enhanced-deferred.js
Created November 7, 2014 17:29
Enhance a deferred promise to have finally/catch methods and state
import Ember from "ember";
export default function () {
var deferred = Ember.Deferred.create(),
promise = new Ember.RSVP.Promise(function(resolve, reject) {
deferred.then(
function () { promise.state = "resolved"; resolve.apply(this, arguments); },
function () { promise.state = "rejected"; reject.apply(this, arguments); }
);
});
@runspired
runspired / .zshrc
Created January 13, 2015 05:46
Enhance your front-end package experience by making it easy to wipe and start over when NPM / Bower screw up.
alias nom='npm cache clean && rm -rf node_modules && npm install'
alias bom='bower cache clean && rm -rf bower_components && bower install'
@runspired
runspired / ember-cli-setup.md
Created January 13, 2015 05:48
ember-cli setup

Install NVM (Node Version Manager). Be sure to check that 0.13.1 is indeed the latest version.

curl https://raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh | bash

Install Node the required version of Node (as of this writing) is v0.11.13

nvm install v0.11.13

Make it your default for when you open a new terminal

@runspired
runspired / touchZone.styl
Last active March 7, 2018 07:19
On mobile, sometimes it's necessary to provide an invisible larger area to recognize touch inputs on a crucial or otherwise difficult to activate button. This is an example of one way of doing so using pseudo elements. In this particular implementation, the buttons this was being added to would shrink while active, so a countering scaling effect…
.touchZone::after
content ' '
display block
width 100%
height 100%
z-index 100
top 0
position absolute
@runspired
runspired / README.md
Created March 11, 2015 17:15
file layout of ember addon trying to import from /app into /test/test-helper.js

MobileTouch overrides event-dispatcher:main by calling reopen on Ember.EventDispatcher (and several other classes) to apply new events and remove unneeded events. The EventDispatcher overrides need access to the user's config file, and thus it is exposed via /app.

I'm trying to figure out how to get the initializer included when setting up the app for testing the addon itself. The above does not resolve.

@runspired
runspired / component.js
Last active August 29, 2015 14:18
Ember Slide Toggle
import Ember from "ember";
export default Ember.Component.extend({
tagName : 'slide-toggle',
classNames : ['slideToggle'],
params: null,
action: null,
@runspired
runspired / slideshow-item.component.js
Last active August 29, 2015 14:18
Explicit Component Nesting
import Ember from "ember";
export default Ember.Component.extend({
active: false,
slideshow: null,
init: function() {
this._super();
/*
* Little example of how to use ```socket-io.client``` and ```request``` from node.js
* to authenticate thru http, and send the cookies during the socket.io handshake.
*/
var io = require('socket.io-client');
var request = require('request');
/*
* This is the jar (like a cookie container) we will use always
@runspired
runspired / Ember.computed.debounce.js
Created May 5, 2015 21:10
Debounced and Throttle computed properties
Ember.computed.debounce = function debouncedProperty() {
var args = [].slice.apply(arguments);
var bounce = args.pop();
var method = args.pop();
var __value = null;
var methodFn = function() {
__value = method.call(this);