Sunday, June 11, 2017

JavaScript full-stack developer self training path

Here is my JavaScript full-stack developer self training path.

Book,
  • Professional JavaScript for Web Developers (3rd Edition, 2011, a little outdated )
    • Chinese version: JavaScript高级程序设计
  • Eloquent JavaScript http://eloquentjavascript.net/
    (This is better. I'd read this one instead of above 1st book if I could do it again.)
    (第一本书稍显臃肿,做参考书不错。如果可以重来,咱推荐这本书,适合初级快速入门.)
online course: freeCodeCamp ,
code skill and technique
Node.js
React


ES6
Data Structure

Prepare interviews, and get the job. Read 2 books.

Lynda.com, take online training courses.
  • Become a Front-End Web Developer, 37h
    url, https://www.lynda.com/learning-paths/Web/become-a-front-end-web-developer
  • Become a Web Developer, 31h
    url, https://www.lynda.com/learning-paths/Web/become-a-web-developer
  • Become a React Developer, 14h #t1
    url, https://www.lynda.com/learning-paths/Web/become-a-react-developer
    • Building and Deploying a Full-Stack React Application 4h #Relay #t3
      url, https://www.lynda.com/React-js-tutorials/Building-Deploying-Full-Stack-React-Application/558648-2.html , #Relay #GraphQL
  • React Native
  • Relay and GraphQL
    • Learning GraphQL #t2
      url, https://www.lynda.com/JavaScript-tutorials/Learning-GraphQL/574714-2.html

Comment:

GitHub 开源项目代码,博客,LeetCode/CodeWars 升级,等等这些,都只能帮你赢得面试,却是很难(基本不可能)帮你拿到一个 Offer。 要想找到好工作,还必须得通过白板算法面试。 从此咱立志成为高级白板面试工程师

另一个因素,很多流行的语言和框架迭代更新速度快。
一位干了五年的前硅谷前端工程师,短短5年,经历了3个主流技术框架,Backbone and JQuery, Angular 1 接下来是 React.
他曾经是响当当的 Angular 1 高级工程师, 可是现在已经少有人对 Angular 1 高级工程师感兴趣了。

然而,数据结构和算法却是相对恒久的。

我1993年大学毕业接触到的数据结构,现在依然垄断了各大软件公司的白板面试。
因此我还是要立刻行动,成为高级白板算法工程师
(博客原文,Whiteboard Interviews Suck, Get Good at Them Anyway. 
https://www.alexkras.com/whiteboard-interviews-suck-get-good-at-them-anyway)

Solution (divide to achievable tasks) and Schedule. * 花时间做规划. * 大段时间做单一任务;减少碎片化的时间;避免任务切换. * 形成日常惯例,减少意志力的损耗. * 有效地娱乐休息.
https://www.zhihu.com/question/28880482/answer/176343416 … ~ 高效人生.


Reference:

Monday, June 5, 2017

Permutation in JavaScript

// Permutations

// Option 1, fix prefix, add a letter to the end of current space.


Source code:

function get_suffix(surffix, charIdx) {
  var arr = surffix.split("");
  arr.splice(charIdx, 1);
  var newSurffix = arr.join("");
  return newSurffix;
}

function permSuffix (str) {
var myArr = [];
var permNext = function f_permNext(prefix, surffix, initStr) {
 //call example:  permNext("","abc","abc");
 var newPrefix = "",
   newSurffix = "";
 var strLen = initStr.length;
 var i = 0;
 console.log("start func: " + prefix, i, surffix);
 if (prefix.length === strLen) {
   myArr.push(prefix);
   console.log("** Combined: " + prefix);
   return;
 }
 for (i = 0; i < surffix.length; i++) {
   newPrefix = prefix + surffix[i];
   newSurffix = get_suffix(surffix, i);
   console.log(newPrefix, i, newSurffix);
    f_permNext(newPrefix, newSurffix, initStr);
 }
};

permNext("", str, str);
return myArr.length;
}

permSuffix("123");

> 6

// options 2,  Introduce and insert a letter to the space of prefix.



Source code:

function introChar(targetStr, chr) {
var arr = [];
var strArr = [];
for (var i=0; i<=targetStr.length; i++) {
strArr = targetStr.split("");
strArr.splice(i, 0, chr);
arr.push(strArr.join(""));
}
return arr;
}

introChar("abc", "1");

function permInsert (str) {
var myArr = [];
var permIntro = function f_intro (arr, pos, permStr) {
console.log(pos, arr, permStr);
var len = permStr.length;
if (pos >= len) {
myArr = myArr.concat(arr);
console.log(arr);
return;
}
if (arr.length === 0) {
arr = introChar("", permStr[0]);
pos++;
}
chr = permStr[pos];
pos++;
arr.forEach( function(val) {
var plusCharArr = introChar(val, chr);
console.log(plusCharArr);
f_intro(plusCharArr, pos, permStr);
});
};
permIntro([], 0, str);
return myArr.length;
}

permInsert("abcde");

> 120

// Reference,  arr is reference type, the paramenter is a link,
// update in a function, update outside arr elements value too.

var yiArr = [7,8,9];

function cut1 (pArr) {
lArr = pArr.slice();
lArr.splice(1, 1);
return lArr;
}

cut1(yiArr);

yiArr;