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:debd64ff9fb3a7be5a0e
Created October 8, 2014 19:44
error when running npm shrinkwrap
npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer jit-grunt@0.7.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-express-server@0.4.13 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-browserify@2.1.4 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-nodemon@0.2.1 wants grunt@~0.4.1
npm ERR! peerinvalid Peer grunt-contrib-watch@0.6.1 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-mocha@0.4.0 wants grunt@~0.4
npm ERR! peerinvalid Peer grunt-extract-sourcemap@0.1.12 wants grunt@~0.4.5
npm ERR! peerinvalid Peer grunt-contrib-jshint@0.10.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-copy@0.4.1 wants grunt@~0.4.0
echo 'kern.maxfiles=20480' | sudo tee -a /etc/sysctl.conf && echo -e 'limit maxfiles 8192 20480\nlimit maxproc 1000 2000' | sudo tee -a /etc/launchd.conf && echo 'ulimit -n 4096' | sudo tee -a /etc/profile
@main-font-size: 16px;
.x-rem (@property, @value) {
// This is a workaround, inspired by https://github.com/borodean/less-properties
@px-fallback: @value * @main-font-size;
-: ~`(function () { return ';@{property}: @{px-fallback}'; }())`;
-: ~`(function () { return ';@{property}: @{value}rem'; }())`;
}
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) {
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
# To just run mongod
sudo mkdir /data
sudo mkdir /data/db
sudo chmod -R 777 /data
mongod
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);
IST-mbenin-4418:copilot mbenin$ bower install
[?] May bower anonymously report usage statistics to improve the tool over time? No/n) n
bower cached git@github.com:CondeNast/mdEditor.git#0.1.1
bower validate 0.1.1 against git@github.com:CondeNast/mdEditor.git#0.1.1
bower cached git@github.com:ckung/ember-model.git#693ab63fa3
bower validate 693ab63fa3 against git@github.com: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
@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);
@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();