Git Product home page Git Product logo

thinkhap.github.io's Introduction

ThinkHap的一些工具和日志

作者:hap

首页:ThinkHap.com

文章:移步 issues

原博客WP数据库丢了,就干脆迁移到这边啦~

thinkhap.github.io's People

Watchers

 avatar  avatar

thinkhap.github.io's Issues

备忘

  1. 二维码解析
  2. 生日时间转换

绑定域名到github.io

  1. 假设你github的用户名为username,那么创建一个名为username.github.io的代码库(repository),在这个库中上传html、CSS等静态页面文件,可以用地址 http://username.github.io 来访问页面了,这个页面就是你账户的主页面(User pages)。
  2. 如果你又创建了个叫repo的代码库,在它下面的gh-pages分支里上传了html、CSS等静态页面文件,那么用http://username.github.io/repo 这个地址就能访问页面了。
  3. 要想域名绑定,在代码库的根目录下放一个CNAME文件就行了,文件里写上想要绑定的域名,然后在域名DNS管理的后台网站建立指向就行。
  4. 如果绑定一级域名,绑定A记录到207.97.227.245,
    如果绑定二级域名,cname到username.github.com.
  5. 等待dns同步

使用Gruntjs遇到的一些坑

GRUNT官方
GRUNT中文

开始使用Grunt :

遇到的问题:

报错
  1. Loading "gruntfile.js" tasks...ERROR
$ grunt
Loading "gruntfile.js" tasks...ERROR
.>> ReferenceError: gruntfile is not defined

这应该就是gruntfile中有语法错误导致的。我是因为把Grunt.file.readJSON('package.json')写成了Gruntfile.readJSON('package.json')导致的。
因为在module.exports = function(grunt){} 引入的变量为grunt
2. Maximum call stack size exceeded

$ grunt uglify
Warning: Maximum call stack size exceeded Use --force to continue.

Aborted due to warnings.

这是因为我的gruntfile中把 grunt.registerTask('uglify', ['uglify']),注册任务的名称与调用的任务重名,导致死循环。修改为grunt.registerTask('js', ['uglify']) 即可。

  • 未完,会不断补充

浏览器工作原理简介

之前都被问到过关于浏览器工作的原理。
比如当你在地址栏中输入一个地址,敲击回车后当页面内容显示出来之后,这段时间浏览器都做了什么。
之前也有看过了很长一篇的浏览器工作原理,看完之后又全忘了。还是在这里记录个简介吧。了解主要过程,这样也不容易忘。


简介

  1. 输入网址http://facebook.com/ 并打开
  2. 浏览器查找域名的IP地址
    • DNS查找过程:
      1. 浏览器缓存
      2. 系统缓存
      3. 路由器缓存
      4. ISP DNS 缓存
      5. 递归搜索
  3. 浏览器给web服务器发送一个http请求
    • GET请求定义了URL, User-Agent, Accept, Accept-Encoding, Cookie等
  4. facebook服务的永久重定向响应301
    • 常见HTTP Code
      1. 301永久重定向:从facebook.com到www.facebook.com
      2. 302临时重定向
      3. 304未修改-缓存
      4. 200成功
      5. 400错误请求
      6. 401未授权
      7. 403禁止访问
      8. 404没有找到
      9. 500服务器内部错误
      10. 503服务不可用
  5. 浏览器跟踪重定向地址,发送新的一个请求到新的地址
  6. 服务器处理请求
    1. Web服务器软件(IIS or APACHE)接收到http请求
    2. 请求处理:阅读请求及它的参数和cookies。生成一个HTML响应
  7. 服务器发回一个HTML响应
    1. 整个响应的大小,内容编码,
    2. Content-type为“text/html”,让浏览器将该响应内容以HTML形式呈现,而不是以文件形式下载。
    3. 浏览器会根据报头信息决定如何解释该响应,不过同时也会考虑像URL扩展内容等其他因素。
  8. 浏览器开始显示HTML
    1. 浏览器没有完整接受全部HTML文档时,就已经开始显示这个页面了。
  9. 浏览器发送获取嵌入在HTML中的对象
    1. img, css, javascript资源文件都要重新经历像html文件类似的过程。。。
    2. 一般静态内容会放在cdn中单独存储分发,可以减少cookies及提高并发下载数
      10.浏览器发送ajax请求。。。
  10. EOF

以上整理自: http://developer.51cto.com/art/201007/209634_all.htm

补充:

长篇介绍:http://www.html5rocks.com/zh/tutorials/internals/howbrowserswork/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.