Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.
####1. anchor file
Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:
| 'use strict'; | |
| var Deferred = function Deferred() { | |
| if (!(this instanceof Deferred)) { | |
| return new Deferred(); | |
| } | |
| var self = this; | |
| self.promise = new Promise(function (resolve, reject) { | |
| self.resolve = resolve; |
| To add port forwards from the command line to a running boot2docker VM use: | |
| VBoxManage controlvm boot2docker-vm natpf1 "name,tcp,127.0.0.1,1234,,1234" | |
| Where 'name' is the unique name for your rule, and '1234' is the port you wish to forward. So for the original Sinatra example: | |
| VBoxManage controlvm boot2docker-vm natpf1 "sinatra-hello,tcp,127.0.0.1,5000,,5000" |
| package org.wkh.learningelasticsearch; | |
| import org.elasticsearch.action.index.IndexResponse; | |
| import org.elasticsearch.action.search.SearchResponse; | |
| import org.elasticsearch.client.Client; | |
| import org.elasticsearch.index.query.QueryBuilders; | |
| import org.elasticsearch.node.Node; | |
| import org.elasticsearch.search.SearchHit; | |
| import org.elasticsearch.search.SearchHits; |
| // Use the browser's built-in functionality to quickly and safely escape the string | |
| function escapeHtml(str) { | |
| var div = document.createElement('div'); | |
| div.appendChild(document.createTextNode(str)); | |
| return div.innerHTML; | |
| }; | |
| // UNSAFE with unsafe strings; only use on previously-escaped ones! | |
| function unescapeHtml(escapedStr) { | |
| var div = document.createElement('div'); |
| // Use the browser's built-in functionality to quickly and safely escape the string | |
| function escapeHtml(str) { | |
| var div = document.createElement('div'); | |
| div.appendChild(document.createTextNode(str)); | |
| return div.innerHTML; | |
| }; |
| describe('controllerCtrl', function () { | |
| var $controller, | |
| $rootScope, | |
| $scope; | |
| beforeEach(module('controller')); | |
| beforeEach(inject(function ($injector) { | |
| $controller = $injector.get('$controller'); | |
| $rootScope = $injector.get('$rootScope'); |