Skip to content

Instantly share code, notes, and snippets.

View JohnnyMa's full-sized avatar
🎯
Focusing

jma JohnnyMa

🎯
Focusing
View GitHub Profile

Access macOS localhost from IE or Edge within Parallels Desktop

This issue is so infuriating that I'm going to take some time to write about it.

  1. MOST IMPORTANT. Your local development server must be bound to IP address 0.0.0.0. Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g. polymer serve --hostname domain.local, hugo serve --bind 0.0.0.0. If you use a named domain like domain.local, it has to be defined in /etc/hosts and pointing at 0.0.0.0.

  2. My Parallels setting is using Shared Network, nothing special there.

  3. Open macOS Terminal and type ifconfig. Look for the value under vnic0 > inet. It is typically 10.211.55.2.

@JohnnyMa
JohnnyMa / .block
Created April 12, 2020 09:35
fresh block
license: mit
@JohnnyMa
JohnnyMa / .block
Last active April 12, 2020 10:03
fresh block
license: mit
@JohnnyMa
JohnnyMa / gist:6c7774fb8f0f7710eb803884c3d58d52
Created April 23, 2016 07:33 — forked from lxneng/gist:1180223
ssh_exchange_identification: Connection closed by remote host
ssh error:
ssh_exchange_identification: Connection closed by remote host
fix:
sudo echo "sshd:ALL" >> /etc/hosts.allow
@JohnnyMa
JohnnyMa / mixin_curry_samples.js
Last active March 30, 2016 03:07
mixin & curry sample code
//# how to add a mixin to an existing class
//## Creating classic mixins
// A simple object with some methods
var DraggableMixin = {
startDrag: function() {
// It will have the context of the main class
console.log('Context = ', this);
},
onDrag: function() {}
@JohnnyMa
JohnnyMa / copy_to_clipboard.js
Created October 9, 2015 06:41
A modern approach to copy text to clipboard, pure js.
<!doctype html>
<html>
<head>
<title>test copy</title>
<script src="clipboard.min.js"></script>
</head>
<body>
<!-- Target -->
<input id="foo" value="test text... text">
@JohnnyMa
JohnnyMa / gist:4fa19265d30955d586b1
Created July 20, 2015 09:10
Binding Methods to Objects
//usually used in event processing
var obj = {
msg: 'Name is',
buildMessage: function (name) {
return this.msg + ' ' + name;
}
}
alert(obj.buildMessage('John')); // displays: Name is John
@JohnnyMa
JohnnyMa / README.md
Last active August 29, 2015 14:19 — forked from JacksonTian/README.md
iOS应用开发技能点

图标上的数字

application.applicationIconBadgeNumber = N; // 设为0隐藏图标数字

从应用打开另一个网页

// 从应用打开一个网页