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 / 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) {
function () { promise.state = "resolved"; resolve.apply(this, arguments); },
function () { promise.state = "rejected"; reject.apply(this, arguments); }
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 /
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 | 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 /
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 / 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 / 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() {
* Little example of how to use ```socket-io.client``` and ```request``` from node.js
* to authenticate thru http, and send the cookies during the handshake.
var io = require('');
var request = require('request');
* This is the jar (like a cookie container) we will use always
* Module requirements.
var XMLHttpRequest = require('xmlhttprequest');
var Polling = require('./polling');
var Emitter = require('component-emitter');
var inherit = require('component-inherit');
var debug = require('debug')('');
function makeCSP(CSP, domains) {
domains.forEach(function(o) {
var domain = makeDomain(o);
domain.sources.forEach(function(source) {
var parts = appendSubdomains(domain.subdomains, domain.domain);
parts = appendProtocols(parts, domain.protocols);
parts = appendPorts(parts, domain.ports);
CSP[source] += ' ' + parts.join(' ');