View jest-dotenv-config.json
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
{ | |
"scripts": { | |
"test": "jest --setupFiles dotenv/config" | |
} | |
} |
View electron-load-str-as-html.js
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
window.loadURL('data:text/html;charset=UTF8,' + encodeURIComponent(htmlContent)); |
View see-things-differently.md
You don't travel to see different things, you travel to see things differently.
View get-git-file-create-time.sh
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
git log --diff-filter=A --follow --format=%aD -1 -- FILENAME |
View set-nextcloud-chunk-size.sh
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
sudo -u www-data php occ config:app:set files max_chunk_size --value 1000000 |
View read-dot-env.sh
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
export $(grep -v '^#' .env | xargs) |
View axios-upload-file-using-form-data.js
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 FormData = require('form-data'); | |
const axios = require('axios'); | |
const file = (await axios.get('https://test.com/test.jpg', { responseType: 'stream' })).data; | |
const formData = new FormData(); | |
formData.append('file', file); | |
const res = await axios.post( | |
'https://test.com/upload', | |
formData, | |
{ |
View vercel-pdf-js.md
在Vercel里直接运行pdf.js包
const pdfjsLib = require("pdfjs-dist/es5/build/pdf.js");
会报下面的错:
Unhandled rejection: Error: Setting up fake worker failed: "Cannot find module './pdf.worker.js'
View express-return-buffer.js
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
import stream from 'stream'; | |
app.get('/', function (req, res) { | |
const buffer = Buffer.from('p8AuXbAKFihL9N1H4aYi7w==', 'base64'); | |
const bufferStream = new stream.PassThrough(); | |
bufferStream.end(buffer); | |
bufferStream.pipe(res); | |
}); |
NewerOlder