Skip to content

Instantly share code, notes, and snippets.

@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

var empty_list = function(selector) {
return selector(undefined, undefined, true);
};
var prepend = function(el, list) {
return function(selector) {
return selector(el, list, false);
};
};
var head = function(list) {
@sorens
sorens / gist:2876942
Created June 5, 2012 18:54
paperclip/aws-sdk failure: Encoding::CompatibilityError (incompatible character encodings: UTF-8 and ASCII-8BIT)
2012-06-05 11:39:14 rails[] FATAL: Encoding::CompatibilityError (incompatible character encodings: UTF-8 and ASCII-8BIT):
aws-sdk (1.5.2) lib/aws/core/log_formatter.rb:280:in `inspect'
aws-sdk (1.5.2) lib/aws/core/log_formatter.rb:280:in `summarize_value'
paperclip (3.0.4) lib/paperclip/storage/s3.rb:105:in `block in summarize_hash'
paperclip (3.0.4) lib/paperclip/storage/s3.rb:105:in `each'
paperclip (3.0.4) lib/paperclip/storage/s3.rb:105:in `map'
paperclip (3.0.4) lib/paperclip/storage/s3.rb:105:in `summarize_hash'
aws-sdk (1.5.2) lib/aws/core/log_formatter.rb:195:in `_options'
aws-sdk (1.5.2) lib/aws/core/log_formatter.rb:169:in `block in format'
aws-sdk (1.5.2) lib/aws/core/log_formatter.rb:169:in `gsub'
@stephenvisser
stephenvisser / app.js
Created May 16, 2012 15:45
Using Twitter Bootstrap NavBars with Backbone.js
//This is the Backbone controller that manages the content of the app
var Content = Backbone.View.extend({
initialize:function(options){
Backbone.history.on('route',function(source, path){
this.render(path);
}, this);
},
//This object defines the content for each of the routes in the application
content:{
"":_.template(document.getElementById("root").innerHTML),
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@grigs
grigs / browserdetect.js
Created March 13, 2012 17:12
Apple's Browser Detection Script - prettified from http://images.apple.com/global/scripts/browserdetect.js
if (typeof (AC) === "undefined") {
AC = {}
}
AC.Detector = {
getAgent: function () {
return navigator.userAgent.toLowerCase()
},
isMac: function (c) {
var d = c || this.getAgent();
return !!d.match(/mac/i)
@mrrooijen
mrrooijen / .gitignore
Created February 1, 2012 18:04
MiddleMan on Heroku configuration.
.DS_Store
*.swp
*.swo
Gemfile.lock
@chrisjacob
chrisjacob / README.md
Created February 18, 2011 03:44
Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Intro

Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Author: Chris Jacob @_chrisjacob

Tutorial (Gist): https://gist.github.com/833223

The Result

@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/