Skip to content

Instantly share code, notes, and snippets.

Fixing npm On Mac OS X for Homebrew Users

If you just want to fix the issue quickly, scroll down to the "solution" section below.

Explanation of the issue

If you're a Mac Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g, you will see an error like this:

$ npm update npm -g
@docherty
docherty / fix-cordova-localnotification-plugin.md
Last active August 29, 2015 14:26
This is a fix for the java error thrown when trying to run v0.8.1 of the cordova localNotification plugin

To fix the build error:

..../platforms/android/cordova/plugin/localnotification/LocalNotification.java:495: error: cannot find symbol webView.evaluateJavascript(js, null);

replace the block starting at line 492 in .../plugins/de.appplant.cordova.plugin.local-notification/src/android/LocalNotification.java with this

webView.getView().post(new Runnable(){
  public void run(){
 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

With the parse.com cordova plugin installed there is an error in Xcode

If you're not using a library which requires the -ObjC linker flag, you can remove -ObjC from your project: Build Settings > Other Linker Flags > remove -ObjC or if you are using a library which requires that flag, you can add the Facebook SDK.

In addition: There is a problem if you remove the -ObjC linker switch. The libCordova.a library specifies some categories on NSString which will not get loaded if -ObjC is removed. A work around is to remove libCordova.a from the linked frameworks and add this to the Other Linker Flags build setting:

@docherty
docherty / iBeacon test controller.js
Created August 26, 2015 20:54
A test Ionic controller to check Cordova iBeacon plugin performance on Android
// JMD iBeacon test
angular.module('beacon-test.controllers',[])
.controller('MainCtrl', ['$scope', '$window', 'localNotification', function ($scope, $window, localNotification){
//console.log('MainCtrl is loaded.');
$scope.ifurl = "";
// functions called by UI buttons
$scope.startMonitoring = function () {
for(i=0; i< $scope.beaconRegions.length; i++){
var beaconRegion = $window.cordova.plugins.locationManager.Regions.fromJson($scope.beaconRegions[i]);
@docherty
docherty / build-extra.gradle
Last active August 28, 2015 09:03
Fix for Cordova android release build translation errors
// JMD addition to stop release build errors caused by missing translations when running this command:
// $ ionic build --release android or $ cordova build --release android
android {
lintOptions {
disable 'MissingTranslation'
disable 'ExtraTranslation'
}
}
@docherty
docherty / ionic-cli-ios-simulator-versions.md
Last active February 3, 2016 22:46
Ionic CLI commands for targeting different ios simulator versions

Should be self explanatory - stored here for easy copy and paste

ios-sim showdevicetypes

ionic run ios -lc --target="iPhone-4s, 8.1"

ionic run ios -lc --target="iPhone-6, 9.2"

@docherty
docherty / wordpress-firebase.php
Created May 19, 2016 19:11 — forked from derekconjar/wordpress-firebase.php
An example of using Firebase and WordPress together. The idea is to use WP's custom post types and metaboxes to make content management easy, and sync with Firebase so that your websites have access to a real-time JSON feed of your custom data.
<?php
/**
* All custom functions should be defined in this class
* and tied to WP hooks/filters w/in the constructor method
*/
class Custom_Functions {
// Custom metaboxes and fields configuration
@docherty
docherty / ViewController.swift
Created June 17, 2016 18:58
Adjust the size UIView to accommodate the size of its content in Swift
//
// ViewController.swift
// sizingTest
//
// A Swift version of John Erck's SO answer:
// http://stackoverflow.com/a/30511982/131385
//
import UIKit
@docherty
docherty / css-spinner.html
Last active October 20, 2017 16:52
A simple CSS spinner
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS spinner</title>
<style>
.wrapper{
background-color: #000;
display: flex;
align-items: center;