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
View select.js
/*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
View enhanced-deferred.js
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.
View .zshrc
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
View ember-cli-setup.md

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 / README.md
Created March 11, 2015 17:15
file layout of ember addon trying to import from /app into /test/test-helper.js
View README.md

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
View component.js
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
View slideshow-item.component.js
import Ember from "ember";
export default Ember.Component.extend({
active: false,
slideshow: null,
init: function() {
this._super();
View gist:8780d2405d84ce7c617d
/*
* 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
View polling-xhr.js
/**
* Module requirements.
*/
var XMLHttpRequest = require('xmlhttprequest');
var Polling = require('./polling');
var Emitter = require('component-emitter');
var inherit = require('component-inherit');
var debug = require('debug')('engine.io-client:polling-xhr');
View environment.js
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(' ');