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 / 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 / README.md
Last active August 29, 2015 14:19 — forked from JacksonTian/README.md
iOS应用开发技能点

图标上的数字

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

从应用打开另一个网页

// 从应用打开一个网页

Node 出现 uncaughtException 之后的优雅退出方案

Node 的异步特性是它最大的魅力,但是在带来便利的同时也带来了不少麻烦和坑,错误捕获就是一个。由于 Node 的异步特性,导致我们无法使用 try/catch 来捕获回调函数中的异常,例如:

try {
    console.log('进入 try/catch');
    require('fs').stat('SOME_FILE_DOES_NOT_EXIST', function readCallback(err, content) {
        if (err) {
            throw err; // 抛出异常

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables