Skip to content

Instantly share code, notes, and snippets.

View simonwoo's full-sized avatar
💭
I may be slow to respond.

Chong WU simonwoo

💭
I may be slow to respond.
View GitHub Profile
/**
* SRouter
* author: dylan<[email protected]>
*/
(function (window) {
'use strict'
window.SRouter = {
routers: [], // 路由规则存储
// One pointer
var partition1 = function(array, start, end) {
if(start === end) {
return;
}
// Choose the first element as pivot
var pivot = array[start];
// last position which is smaller than pivot
var small = start;
for(var index = start + 1; index <= end; index++) {

高质量的代码

  • 正确性
  • 鲁棒性(代码容错能力,特别输入,边界情况等)

代码的规范性

  • 清晰的书写
  • 清晰的布局
  • 合理的命名

代码的完整性

基础知识

  • 数据结构和算法
  • 语言基础
  • 编程能力
  • 数学知识
  • 问题分析和推理能力
  • 常见的设计模式,UML图等

数据结构

  • 线性结构

题目: 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下的递增的顺序排序。 请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。

例子: 查找数字7 -> true;查找数字5 -> false。

1 2 8 9
2 4 9 12
4 7 10 13
6 8 11 15

面试的三种形式

  • 电话面试: 尽可能用形象的语言把细节说清楚。
  • 共享桌面远程面试: 编程习惯。
  • 现场面试: 准备几个问题问面试官。

面试的三个环节

项目经验(遵从STAR模型)

  • Situation(简短的项目背景)
    • 项目规模,开发的软件功能,目标用户。
  • Task(自己完成的任务)

渲染是针对directive来讲的,angularJS内置了很多directive,我们也可以之定义directive,这些directive最终都是通过 $compile service来完成渲染工作的。

$compile service主要分为两个阶段:compile 和 link。

  • 首先$compile会遍历DOM,收集所有的directive,如果同一element有多个directive,那么会根据piroirty来排优先级。
  • 调用所有的directive的compile函数,每个directive的compile会返回一个link函数(包含当前的scope),将这些link函数组合成一个函数fnLink。
  • 在link阶段,将$rootScope传递给fnLink(这时angular会将相应module data添加到$watch list),执行生成View。

可以通过一下代码理解:

#2015-2016前端体系知识图谱

一、框架与组件

#### bootstrap等UI框架设计与实现

  • 伸缩布局:grid网格布局
@simonwoo
simonwoo / Pubsub.js
Last active September 6, 2016 21:29
var events = (function() {
var topics = {};
return {
publish: function(topic, info) {
console.log('publish a topic:' + topic);
if (topics.hasOwnProperty(topic)) {
topics[topic].forEach(function(handler) {
handler(info ? info : {});
})
@mixin ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;