nodejs Get promise request

let browserStackConf = () => {
//curl -u “kuangmingchen1:Qm9ns9rQpFbAWzQxfxQx"
var options = {
hostname: ‘’,
path: ‘/automate/browsers.json’,
method: ‘GET’,
auth: ‘kuangmingchen1:Qm9ns9rQpFbAWzQxfxQx’

return new Promise((resolve) =>{
var body= “;
const req = https.request(options, (res) => {
res.on(‘data’, (d) => {
body += d;
res.on(‘end’, () => {
console.log(‘…… no more response’, JSON.parse(body));
let a = [{
seleniumAddress: ‘’,
‘browserstack.user’: ‘kuangmingchen1’,
‘browserstack.key’: ‘Qm9ns9rQpFbAWzQxfxQx’,
‘browserstack.debug’: true,
‘os’: ‘Windows’,
‘os_version’: ‘8.1’,
‘browserName’: ‘Chrome’,
‘browser_version’: ‘54.0’,
‘resolution’: ‘1280×1024’,
specs: [ ‘scenarios/_bundle.js’ ],
resultJsonOutputFile: null,
restartBrowserBetweenTests: false,
allScriptsTimeout: 90000,
jasmineNodeOpts: {
defaultTimeoutInterval: 2500000
let b = JSON.parse(body);
let s = _.filter(b, (a) => { return a[‘browser’] == ‘chrome’;}).max(s, function(stooge){ return stooge.age; });

張貼在 Uncategorized | 發表留言

Angular debugging



張貼在 Uncategorized | 發表留言

mac system

Homebrew directory:


Ctags on mac:

# you have ctags but it does not work…
$ ctags -R –exclude=.git –exclude=log *
ctags: illegal option — R
usage: ctags [-BFadtuwvx] [-f tagsfile] file …

#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew –prefix`/bin/ctags"
#try again! ctags -R –exclude=.git –exclude=log *
#puts tags file into you .gitignore (probably global) and you’re all set!
#PS. i was inspired to install ctags by video by @r00k, thanks man!

Apache on Mac:
Mac OS X includes an Apache web server that can be controlled using apachectl as root. It’s usually started via launchd, the corresponding configuration file is /System/Library/LaunchAgents/org.apache.httpd.plist. If it’s not this Apache running on port 80, it is probably launchd, Apple’s implementation of a daemon manager.

Resize tmux screen:
Ctrl-B then option/alt-up/down

張貼在 Uncategorized | 發表留言

what process is running on port

lsof -n -i4TCP:{PORT} | grep LISTEN

張貼在 Uncategorized | 發表留言

Add shortcuts in Mach

jump between words and start/end of lines in iTerm2 follow these steps:

  • Go to iTerm2 Preferences (⌘,)
  • Open the “Keys” tab
  • Add the following Global Shortcut Keys

Jump to beginning of word

  • Keyboard Combination: ⌥←
  • Action: Send Escape Sequence
  • Escape: b

Jump to end of word

  • Keyboard Combination: ⌥→
  • Action: Send Escape Sequence
  • Escape: f

Jump to beginning of line

  • Keyboard Combination: ⌘←
  • Action: Send Hex Code
  • Escape: 0x01

Jump to end of line

  • Keyboard Combination: ⌘→
  • Action: Send Hex Code
  • Escape: 0x05

Don’t forget to remove the previous bindings:

  • Open the “Profiles” tab
  • Click the sub-tab ”Keys”
  • Remove the mappings for key combinations ⌥← and ⌥→
張貼在 Uncategorized | 發表留言

React optimization

張貼在 Uncategorized | 發表留言

Dependency injection

View story at

張貼在 Uncategorized | 發表留言