web pack optimization bundle

前往 Medium.com 檢視

前往 Medium.com 檢視

張貼在 Uncategorized | 發表留言

nodejs Get promise request

let browserStackConf = () => {
//curl -u “kuangmingchen1:Qm9ns9rQpFbAWzQxfxQx" https://www.browserstack.com/automate/browsers.json
var options = {
hostname: ‘www.browserstack.com’,
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: ‘http://hub-cloud.browserstack.com/wd/hub’,
‘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; });
console.log(s)
resolve(a);
//resolve(JSON.parse(body));
});
});
req.end();
});
};

張貼在 Uncategorized | 發表留言

Angular debugging

angular.element(document.querySelectorAll(‘i.icon-checkMark’))[0].$scope();

angular.element(document.querySelector(‘i.icon-checkMark’)).data().$classCounts;

張貼在 Uncategorized | 發表留言

mac system

Homebrew directory:

~/Library/Caches/Homebrew/ctags-5.8_1.el_capitan.bottle.tar.gz

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 https://workshops.thoughtbot.com/vim 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.

http://superuser.com/questions/597398/no-idea-what-is-listening-on-port-80-in-os-x

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

張貼在 Uncategorized | 發表留言

what process is running on port

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

http://stackoverflow.com/questions/4421633/who-is-listening-on-a-given-tcp-port-on-mac-os-x

張貼在 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

http://jaero.space/blog/react-performance-1

張貼在 Uncategorized | 發表留言

Dependency injection

前往 Medium.com 檢視

張貼在 Uncategorized | 發表留言

Babel

http://www.ruanyifeng.com/blog/2016/01/babel.html

張貼在 Uncategorized | 發表留言

Finding A Dream Job in Unlikely Places

前往 Medium.com 檢視

張貼在 Uncategorized | 發表留言