JavaScript学习笔记-Map& Set
MapES6标准引进的key-value数据类型,相当于python中的dictionary增加查找速度,本质上是将键值利用哈希算法类似变量存储。
var m = new Map([['Michael', 95], ['Bob', 75], ['Tracy', 85]]);//初始化Map需要一个二维数组m.get('Michael'); // 95
或者直接初始化一个空Map。Map具有以下方法
var m = new Map(); // 空Mapm.set('Adam', 67); // 添加新的key-valuem.set('Bob', 59);m.has('Adam'); // 是否存在key 'Adam': truem.get('Adam'); // 67m.delete('Adam'); // 删除key 'Adam'm.get('Adam ...
JavaScript学习笔记-Object
对象javaScript的对象是一种无序的集合数据类型,它由若干键值对组成
var xiaoming = { name: '小明', birth: 1990, 'middle-school': 'No.1 Middle School', height: 1.70, weight: 65, score: null};
注意,最后一个键值对不需要在末尾加,,如果加了,有的浏览器(如低版本的IE)将报错。
使用属性>xiaoming.name; '小明'>xiaoming['name']; '小明'>xiaoming.birth; 1990>xiaoming['middle-school']; 'No.1 Middle School'
属性名middle-school不是一个有效的变量,就需要用’’括起来。访问这个属性也无法使用.操作符,必须用[‘xxx’ ...
倒腾Pelican - Elegant Set Sidebar
依然是初期的一些乱七八糟倒腾系列。不过让我接触了Git,Markdown,静态页面,部署,等等。
Default sidebar optionsAccording to the metadata in your articles,sidebar shows:
1. You can activate Pushlish date, Modification date, Category, Tags functions by specify optional meta data variables Date, Modified, Category and Tags when editing your articles.
2. Social links is set in your ‘pelicanconfig.py’, just add your links to the Dictionary
# Social widgetSOCIAL = (('GitHub', 'https://....'), (' ...
倒腾Pelican - Collapse does not work
这里发现了一个叫Elegent的主题,现在不知道还有没有,那时候这里面的特色,使用折叠效果来展示文章分类。貌似是因为jQuery依赖出了问题,这个动效不生效,所以一顿修改。那时候连jQuery,Bootstrap,HTML都不懂,就凭借着常年debug的技能去修改。
IssueThis happens with the file elegant/templates/base.html, which rules the element of every pagesat around line 97 , there is a quote:
<script src="http://code.jquery.com/jquery.min.js"></script>
it seems the http request is nolonger credited in this case, and a potential consequence is that:The following collapse funtion in elegant/te ...
倒腾Pelican - 博客配置
Latest set#!/usr/bin/env python# -*- coding: utf-8 -*- #from __future__ import unicode_literalsAUTHOR = 'Jiheng Hu'SITENAME = "Jiheng's Blog"SITEURL = 'https://jihenghu.github.io'PATH = 'content'TIMEZONE = 'Asia/Shanghai'#DATE_FORMATS = {'zh':'%Y-%m-%d %H:%M'}DATE_FORMATS = {'en': '%a, %d %b %Y %H:%M'}THEME = 'pelican-elegant'DISQUS_SITENAME = 'jihenghu'COMMENTS_ ...
倒腾Pelican - Favicon not recognized
这是最初的几篇博客,那时候甚至不懂favicon怎么设置,慢慢的,我还没系统学习前端,这些知识就粗粗了解了。
1. In ‘pelicanconf.py’ , setUSE_SHORTCUT_ICONS = True SITELOGO = 'images/favicon.ico' FAVICON = 'images/favicon.ico' SITELOGO_SIZE = 15 ``` ### 2. Put your `favicon.ico` in path `content/images/` ### 3. In `elegant/templates/_includes/favicon_links.html` #### replace following :```html <link rel="shortcut icon" href="{{ SITEURL }}/theme/images/favicon.ico" type ...
倒腾Pelican - Auto-publish shell script for pelican blog
这是最初的那段时光,啥也不懂,不懂前端,不懂框架。那时候才研究生二年级,脑子里酝酿着转行找工作。先学Python,后学pelican,才慢慢引导我向前端进发。后来如愿拿了一堆offer, 思科,中兴,华为,海康,TPLink,寒武纪。岗位从前端到后端到云计算开发。虽然后来又经历了很多事,但是最初开始学习新鲜东西的情形仍旧历历在目。在寒假的学校,冬雪开始飘着……
First time configurationFor the first time commit to you github, you need a local git configuration.Use the commandline:
$ git config --global user.name "your name"
$ git config --global user.email johndoe@example.com
you can see your global config. using:
$ git config --list
user.name=your name
us ...