把 Caps Lock 變成智慧的 Control 以及 Escape :
- 單獨輕按一下就是 Escape 。
- 若按下時同時按著其他鍵,就會是 Control 。
這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)
- Send Escape if you tap Caps Lock alone.
| var fs = require('fs'); | |
| var httpProxy = require('http-proxy'); | |
| var http = require('http'); | |
| var https = require('https'); | |
| var express = require('express'); | |
| var app = express(); | |
| app.use(function (req, res, next) { | |
| console.log(req); | |
| if (req.url === '/') { |
So one of the painful points of using docker on OS X is that you need to run a virtualbox VM, which often suffers from performance issues. With xhyve, a OS X virtualization system, and docker-machine-xhyve you can now have docker use the native OS X hypervisor to run containers.
No more dealing with virtualbox shenanigans!
In this script, I've also set up a way to autoconfigure terminal sessions to load docker's environment vars (dependent on docker-machine) so you do not have to run eval $(docker-machine env whatever) every time you open a new terminal window.
| #!/bin/sh | |
| # Usage: | |
| # ./clone.sh TESTENV_TO_CLONE_DIR NEW_TEST_ENV_DIR | |
| # ./clone.sh TESTENV08-HOST TESTENV03-HOST | |
| # The above will clone 08 to 03 and register the vm | |
| # | |
| # * Do not end the argument directories with a slash! | |
| # Date: Mar 10, 2015 | |
| DIR_DS=$(pwd) |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent| -- load the log module | |
| local log = require("log") | |
| -- some function for demo | |
| function add(a, b) | |
| return a+b | |
| end | |
| -- wrap the main script in a main function | |
| function main() |
| var request = require('request'); | |
| var async = require('async'); | |
| async.parallel( | |
| { | |
| data1: function(callback) { | |
| request('someUrl', function (error, response, body) { | |
| callback(error, body); | |
| }); | |
| }, |
Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:
NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.
Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.