HTML, CSS and Javascript
总结下基础概念
!!
首先,node.js 为 JavaScript 的运行环境,而 npm (Node Package Manager) 作为默认
的包管理器,下载和更新项目所需的第三方依赖 —— 之前我们使用 npm install --save hexo-blog-encrypt 创建了 A Secret 加密页面。
以面对对象编程语言为例,如果说 JavaScript 对应 Python,node.js 可以理解为python interpreter,npm 则对应 pip。
此外,JavaScript 有一种常见的数据格式 JSON (JavaScript Object Notation),用于储存不同类型字符串。例如,在 Github Issue 中存储
JSON 格式对象来捕捉小组件的计数。类似的,它可以看作 Python 中的字典,两者之间也可相互转换,如下所示:
JSON 转换为字典
import json
# 下载到一串 JSON 文本
json_text = '{"nam ...
Global “Like / Stomp” Widget—GitHub ISSUE + Vercel Func
Real-Time Reactions
对于任何 hexo blog, 基于 Github+Vercel 实现 global 计数同步小组件!!
这里,Github Issue 作为我们的轻量级数据库,正文以 {} 开头,我们在其中存储一个小的 JSON 对象,
将每个 widget 的 Key(例如 "wb-p1" )映射到它的总计数
而 Vercel 作用是什么呢? 我们使用 Vercel 在 /api/vote 处托管了一个微小的无服务器功能,该功能面向 GitHub Issue。
将 GitHub PAT 作为环境变量输入,处理 CORS "跨域资源共享 (Cross-origin resource sharing)",当浏览器调用 GET /api/vote?key=… 时,Vercel 就会获取并返回 JSON 更新 ISSUE (即计数总量)。
Setup in 3 Steps ▼
GitHub — create Issue __VOTES__, body ...
Debugging Memo
🌐 Website Building
Problem 1 — Token expired, cannot git push
Click to reveal solution
Flush stale credential with:
git credential-osxkeychain erase protocol=https host=github.com
…then run hexo d and paste the new PAT.
git credential-osxkeychain erase protocol=https host=github.com
0
Problem 2 — Search pop-up unstyled ...
Transport-Phenomena
Transport-Phenomena 1st Release
Velocity profiles and the stress components. For each of the following velocity
distributions, draw a meaningful sketch showing the flow pattern. Then find all the components for the Newtonian fluid. The parameter b is a constant.
Below is the Python codes solution:
# Todo: Problem 1 (a)
import numpy as np
import matplotlib.pyplot as plt
b = 1
x = np.linspace(-3, 3, 20)
y = np.linspace(-3, 3, 20)
X, Y = np.meshgrid(x, y)
vx = b * Y
vy = np.zeros_lik ...
Maxwell's Relations & Mixtures
Problems 麦克斯韦关系9.9 Rubber bands are entropic springs. 橡胶带是熵弹簧。Experiments show that the retractive force f of polymeric elastomers as a function of temperature T and expansion L is approximately given by f(T,L) = aT(L−L0) where a and L0 are constants. (a) Use Maxwell’s relations to determine the entropy and enthalpy, S(L) and H(L), at constant T and p. (b) If you adiabatically stretch a rubber band by a small amount, its temperature increases, but its volume does not change. Derive an e ...
PyG Walker Visualization
“PyG Walker” 开源可视化工具可实现基于jupyter, kaggle和Colab的数据分析
E.g. Jupter Notebook1234567import pandas as pdimport pygwalker as pygdf = pd.read_csv('random_data.csv')mydata = pyg.walk(df)# Data statistics and visualization schematic are as follows:
配色是一门艺术🎨
Great Color Palette
adopted in this article
三色渐变:linear-gradient(135deg,#8a7bbf 0%,#6f60aa 30%,#473C7A 60%,#2E294E 100%)四色翻转:-webkit-linear-gradient(90deg,#462f76,#dd4660,#473c7a,#74ed97)三色翻转(暗橙色)-webkit-linear-gradie ...

