Skip to content

Instantly share code, notes, and snippets.

View michael-benin-CN's full-sized avatar

Michael Benin michael-benin-CN

View GitHub Profile
@michael-benin-CN
michael-benin-CN / gist:6939969
Last active December 25, 2015 07:29
Sample Error Message in Ember
Uncaught ReferenceError: <App.ModalController:ember820>#needs does not include `preview`.
To access the preview controller from <App.ModalController:ember820>,
<App.ModalController:ember820> should have a `needs` property that is
an array of the controllers it has access to.
@michael-benin-CN
michael-benin-CN / gist:7267027
Created November 1, 2013 15:22
Sample error log from EmberJS
Uncaught ReferenceError: <App.GalleriesIndexController:ember1446>#needs does not include `current_user`. To access the current_user controller from <App.GalleriesIndexController:ember1446>, <App.GalleriesIndexController:ember1446> should have a `needs` property that is an array of the controllers it has access to.
@michael-benin-CN
michael-benin-CN / gist:8927111
Created February 11, 2014 00:31
Dynamically adding properties with a one liner - can it be done? Want to simplify.
var lessFiles = {};
lessFiles['public/css/copilot-' + version + '.css'] = 'public/less/copilot.less';
@michael-benin-CN
michael-benin-CN / gist:8977851
Created February 13, 2014 16:02
cookie util
'use strict';
module.exports = {
create: function (name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
@michael-benin-CN
michael-benin-CN / bind vs. scoping self
Created February 25, 2014 16:56
This is an example of bind vs self scoping. Which do you prefer?
init: function () {
setInterval(function () {
ajax('/last-modified', {
cache: false
}).then(function (data) {
if (moment(this.get('date')).isBefore(data.modified)) {
this.set('appUpdated', true);
}
}.bind(this), function (e) {
//console.log(e);
IST-mbenin-4418:copilot mbenin$ bower install
[?] May bower anonymously report usage statistics to improve the tool over time? No/n) n
bower cached [email protected]:CondeNast/mdEditor.git#0.1.1
bower validate 0.1.1 against [email protected]:CondeNast/mdEditor.git#0.1.1
bower cached [email protected]:ckung/ember-model.git#693ab63fa3
bower validate 693ab63fa3 against [email protected]:ckung/ember-model.git#conde
bower cached git://github.com/components/ember.git#1.0.1
bower validate 1.0.1 against git://github.com/components/ember.git#~1.0.0-rc.6
bower cached git://github.com/jquery/jquery.git#2.0.3
bower validate 2.0.3 against git://github.com/jquery/jquery.git#~2.0.3
var Promise = require('bluebird');
var promiseWhile = function(condition, action) {
var resolver = Promise.defer();
var loop = function() {
if (!condition()) return resolver.resolve();
return Promise.cast(action())
.then(loop)
.catch(resolver.reject);
# To just run mongod
sudo mkdir /data
sudo mkdir /data/db
sudo chmod -R 777 /data
mongod
javascript: void(
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName('head');
function LABjsLoaded() {
window.sourceMapSupport.install();
}
// loading code borrowed directly from LABjs itself
var express = require('express');
var Promise = require('es6-promise').Promise;
var http = require('http');
var app = express();
var getJSON = function(options) {
console.log('CALLING ' + options['host']);
var promise = new Promise(function(resolve, reject) {
var req = http.get(options, function(res) {