Skip to content

Instantly share code, notes, and snippets.

View p2yang's full-sized avatar
🎯
Focusing

Joe p2yang

🎯
Focusing
View GitHub Profile
@p2yang
p2yang / download.js
Last active February 12, 2020 07:16
原生 fetch download file
async function download (url = '', headers = {}) {
try {
const res = await fetch(url, {
headers
})
const blob = await res.blob()
// 获取后端headers里面的文件名
const filename = decodeURI(res.headers.get('Content-Disposition').split('filename=')[1])
// download
const a = document.createElement('a')
@p2yang
p2yang / debounce-throttle.js
Created January 2, 2020 14:04
debounce-throttle
export function debounce(fn, delay = 500) {
let timer = null
return function () {
clearTimeout(timer)
timeout = setTimeout(() => {
fn.apply(this, arguments)
}, delay)
}
}
@p2yang
p2yang / .gitlab-ci.yml
Created May 7, 2018 06:07 — forked from thornbill/.gitlab-ci.yml
Example Node GitLab CI Yamlfile
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:6
before_script:
- npm install
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
@p2yang
p2yang / cloudSettings
Created March 8, 2018 11:43
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-03-08T11:42:51.414Z","extensionVersion":"v2.9.0"}
@p2yang
p2yang / readme.md
Created June 23, 2017 03:10
gist page

A test for the page