凭海临风的IT江湖

  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

  • 站点地图

  • 公益 404

  • 时间轴

  • 搜索

javascript asynchronous programming learning :event

发表于 2015-04-20 | 更新于 2022-08-18 | 分类于 javascript , 异步
本文字数: 424 | 阅读时长 ≈ 1 分钟

javascript异步编程读书笔记之事件机制

事件的调度

  • 异步执行

setTimeout函数的解释:给定一个回调及n毫秒的延迟,setTimeout会在n毫秒后运行该回调。

代码清单1:

1
2
3
4
5
for (var i = 1; i <= 3; i++) {
setTimeout(function(){
console.log(i); },
0);
};

输出结果:

1
2
3
4
4
4
  • 线程阻塞
    代码清单2:

    1
    2
    3
    4
    5
    6
    var start = new Date;
    setTimeout(function(){
    var end = new Date;
    console.log('Time elapsed:', end - start, 'ms');
    }, 500);
    while (new Date - start < 1000) {};
  • 队列

javascript使用队列的方式来循环处理请求,这种机制被称为事件循环。

use-shorturl and two-dimensional-barcodes to beautify blog

发表于 2015-04-20 | 更新于 2022-08-18 | 分类于 搭建博客
本文字数: 370 | 阅读时长 ≈ 1 分钟

如何使用短网址和二维码简化网站访问

  1. 短网址(shorturl)
    web2.0时代的潮流,借助短网址您可以用简短的网址替代原来冗长的网址,让使用者可以更容易的分享链接。
    这里我使用的是百度的短网址服务:http://dwz.cn/
    1. 访问http://dwz.cn/主页
    2. 输入你的博客地址
      我输入http://jeffsui.github.io/pinghailinfeng_blog/
    3. 复制短网址
  2. 二维码(two-dimensional-barcodes)
    微信时代,不知道二维码的基本都属于外星球人了。
    这里我选择的是草料二维码:
    http://cli.im/
    1. 输入二维码地址
    2. 进行一些基本设置
      包括前景色、背景色、渐变色等等。
    3. 嵌入图片
    4. 选用你喜欢的模板
    5. 保存二维码
  3. 在线存储
    这里我选择国内知名的七牛云存储(七牛不免费了,我迁移到了github)
  4. 在博客中引用图片地址就可以了

我的新文章

发表于 2015-04-17 | 更新于 2022-08-18
本文字数: 75 | 阅读时长 ≈ 1 分钟

#我的新文章

这是我的第一篇在github上的博客。记录下我的工作和生活,慢慢给其他的文章都更新到这里。嬉笑怒骂也好,喜怒哀乐也罢,我就是一个俗人罢了。

push-hexo-to-github

发表于 2015-04-17 | 更新于 2022-08-18 | 分类于 hexo
本文字数: 1.6k | 阅读时长 ≈ 1 分钟

如何使用hexo在github上建立静态博客

环境搭建

  1. hexo环境搭建

    请参考 hexo.io 官方站点,
    强烈建议给基本操作下的内容快速浏览一遍,下面的操作是我一个一个命令敲出来的,遇到的坑也会记录下来,希望大家能少走弯路。

  2. github上建立静态博客

    1. github账号申请(略)
    2. 建立一个github项目
    3. git clone 项目地址 到本地
    4. 项目初始化

      cd 项目名
      echo # hexo 实例站点 >> README.md
      git init
      git add README.md
      git commit -m “first blood”
      git remote add origin 项目地址
      git push -u origin master
    5. github免费站点建立规则,请仔细阅读这个规则
      https://help.github.com/articles/user-organization-and-project-pages/

    6. 默认github域名

      默认github 分配了 一个name.github.io的域名,
      还有一个name.github.io/project_name的二级域名,
      请参照github的提示设置URL。

华丽的分割线

  1. 站点配置流程

    1. 建立站点文件夹,并站点初始化
    2. 安装hexo依赖
    3. 修改node_module/hexo-server/index.js,用于本地调试
    4. 安装hexo-git-deployer插件
    5. 修改全局配置文件_config.yml,配置deploy


      # Site 站点配置
      title: 凭海临风的测试江湖
      subtitle:
      description: 凭海临风的博客
      author: Jeff Sui
      language: zh-CN
      timezone

      </code></pre>
      


      # URL 站点链接
      ## If your site is put in a subdirectory, set url as ‘http://yoursite.com/child' and root as ‘/child/‘
      url: http://jeffsui.github.io
      root: /pinghailinfeng_blog/
      permalink: :year/:month/:day/:title/
      permalink_defaults:


      # Deployment
      ## Docs: http://hexo.io/docs/deployment.html
      deploy:
      type: git
      repo: https://github.com/jeffsui/pinghailinfeng_blog.git
      branch : master
      message :

      以上配置仅供参考

  2. 创建文章

    • 执行hexo new 命令

      例如:hexo new post my-first-blog

      将会自动在source/_posts下创建一个my-first-blog.md的文件,使用的是scaffolds下的post.md模板

    • 修改并保存my-first-blog.md文件

    • 站点生成hexo g

    • 站点部署 hexo d

      如果没有报错,恭喜你已经成功推送到 项目的master分支。

  3. 创建gh-pages分支并推送到远程


    git fetch origin master
    git checkout gh-pages
    git merge master
    git push origin gh-pages

  4. 访问http://jeffsui.github.io/pinghailinfeng_blog/

遇到的问题

  1. github站点的规则不熟悉,url配置浪费我2个小时。项目建立的是二级域名,所以必须要按照我说的那样配置。
  2. 本地预览有可能不加载样式,重新删除node_module下所有,执行npm install,再hexo g,hexo server -i 127.0.0.1 -s -o即可。
  3. hexo3.0版本的git插件必须要独立安装。
  4. 其他坑,自己填吧。

总结

大坑各种有,github特别多,还有伟大的墙,兄弟们,github好上,填坑需谨慎!

sublime run slow problem

发表于 2015-04-17 | 更新于 2022-08-18 | 分类于 工具篇
本文字数: 163 | 阅读时长 ≈ 1 分钟

解决sublime Text2运行缓慢的方法

今天打开sublime想写博客发现整个页面打开很慢,切换tab要等好几秒。
发现了一个帖子,说GitGutter这个插件在st2下会影响切换tab速度。

于是 ctrl+shift+p调出命令,remove package,选择GitGutter,回车。
重启sublime,世界都变得清静了。

first-blog

发表于 2015-04-17 | 更新于 2022-08-18 | 分类于 搭建博客
本文字数: 22 | 阅读时长 ≈ 1 分钟

#第一个博客

##记录使用hexo的各种填坑。

1…1415
Jeff Sui

Jeff Sui

146 日志
35 分类
166 标签
RSS
GitHub E-Mail
  • 20201
  • 2to31
  • Boolean1
  • Centos2
  • Exception1
  • GIL1
  • GitGutter1
  • Tkinter1
  • TypeScript2
  • XML2
  • __all__1
  • _thread1
  • app1
  • argparse2
  • array1
  • atexit1
  • bisect1
  • calendar1
  • centos1
  • checkbox1
  • cmath1
  • cmd1
  • code1
  • collections.abc1
  • concurrent1
  • context-manager-types1
  • cookies1
  • copy1
  • coroutines1
  • csv1
  • cygwin1
  • dataclasses1
  • dbm1
  • dict1
  • dictionary1
  • difflib1
  • dis1
  • django4
  • docker3
  • doctest1
  • dom1
  • eclipse1
  • enum1
  • es61
  • esp323
  • esptool1
  • ffmpeg1
  • filecmp1
  • fileinput1
  • fractions1
  • functools1
  • futures1
  • gc1
  • generator1
  • git4
  • gitcafe1
  • github1
  • glob1
  • heapq1
  • hexo2
  • html.parser1
  • http2
  • http.server1
  • ios1
  • iterator1
  • itertools1
  • java3
  • javascript6
  • javaweb2
  • jdk1
  • jira1
  • json1
  • juypter1
  • keyword1
  • linecache1
  • linux2
  • lite-server1
  • m3u81
  • maven4
  • micorpython1
  • micropython2
  • minidom1
  • modulefinder1
  • mongodb1
  • mybatis1
  • mysql1
  • nbextension1
  • nginx1
  • nodejs1
  • oop1
  • operator1
  • os1
  • os.path1
  • others1
  • photo1
  • pickle1
  • pprint1
  • pwd1
  • python94
  • python31
  • queue1
  • re1
  • readline1
  • registry2
  • registry-ui2
  • reprlib1
  • sax1
  • sched1
  • select1
  • selectors1
  • selenium3
  • shutil1
  • socket1
  • sort1
  • spring1
  • sqlite32
  • ssm1
  • standar_library1
  • standard_library78
  • statistics1
  • string1
  • sublime1
  • tempfile1
  • this1
  • thread1
  • timeit1
  • turtle2
  • types1
  • uPycraft1
  • unittest1
  • urllib.robotparser1
  • uuid1
  • uv1
  • venv1
  • vscode1
  • weakref1
  • web test2
  • webbrowser1
  • webrepl1
  • windows3
  • xml2
  • 二维码1
  • 办公1
  • 博客3
  • 坑1
  • 字典1
  • 异步1
  • 循环1
  • 感悟1
  • 持续集成1
  • 搭建1
  • 搭建博客1
  • 文章1
  • 杂记3
  • 版本管理2
  • 短网址1
  • 禅道1
  • 笔记1
  • 约束1
  • 网易音乐1
  • 美化1
  • 自动化测试1
  • 软件工程1
  • 逆向工程1
  • 闭包1
  • 项目管理2
© 2015 – 2025 Jeff Sui | 811k | 12:18
由 Hexo 强力驱动 v3.9.0
|
主题 – NexT.Gemini v7.1.1
|
0%