git checkout --track origin/<branc-name>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 表格斜角线 | |
table td.crossed | |
{ | |
background-image: linear-gradient(to bottom right, transparent calc(50% - 1px), red, transparent calc(50% + 1px)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cssom = { | |
// 获取元素在页面的绝对位置 | |
absPosition(node) { | |
return node.getBoundingClientRect().top < 0 ? window.pageYOffset - Math.abs(node.getBoundingClientRect().top) : window.pageYOffset + node.getBoundingClientRect().top | |
}, | |
// 读取页面垂直方向已滚动距离 | |
readScrollY() { | |
return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop | |
}, | |
// 设置页面垂直滚动位置 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container { | |
&::-webkit-scrollbar { | |
width: 8px; | |
cursor: grab; | |
} | |
&::-webkit-scrollbar-thumb { | |
border-radius: 0; | |
background: #2c2f4e; | |
cursor: grab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const phone = '^1\d{10}$' // 11 phone number | |
const title = '^[\u4e00-\u9fa5_a-zA-Z0-9]+$' // chinese, English, number, _ | |
const domain = '^[a-zA-Z0-9][a-zA-Z0-9\-\.]{0,61}[^\.\-]$' // domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference: https://github.com/souhe/reactScrollbar/blob/master/src/js/ScrollArea.jsx | |
// Always use this to implement elastic scroll animation | |
const test = document.getElementById('test'); | |
let timeStamp = 0; | |
let eventPreviousValues = {}; | |
test.addEventListener('touchstart', () => { | |
console.log('start'); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const path = require('path'); | |
const fs = require('fs'); | |
const url = require('url'); | |
const os = require('os'); | |
const server = new http.Server(); | |
const interfaces = os.networkInterfaces(); | |
const addresses = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const os = require('os'); | |
const interfaces = os.networkInterfaces(); | |
const addresses = []; | |
for (let k in interfaces) { | |
for (let k2 in interfaces[k]) { | |
let address = interfaces[k][k2]; | |
if (address.family === 'IPv4' && !address.internal) { | |
addresses.push(address.address); |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
NewerOlder