title: "مجموعه سوالات استخدامی ریاکت react.js" author: JafarRezaei date: August 30, 2020 export_on_save: html: true puppeteer: landscape: false printBackground: true timeout: 3000
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
// add extra page just generated files | |
html = ` | |
<div class="a4"> | |
<div class="book-starter center"> | |
به نام خدا | |
</div> | |
<div class="book-name center"> | |
<span>مجموعه سوالات استخدامی </span> | |
<span class="font-black">ریاکت React.js</span> | |
</div> |
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
// back to specific answer | |
html = html.replace( | |
/<h3><a .*\S+=["']?#((?:.(?!["']?\s*?[>"']))+.)["']?.*>(?:.\n*(?!(?:backToTop)))+<a class="backToTop" \S+=["']?#((?:.(?!["']?\s*?[>"']))+.)["']?.*>(?:.(?!\s+(?:\S+)|\s*?[>"']))+.[<]/gm, | |
(whole, p1, p2) => whole.replace(p2, `${p1}-q`) | |
); |
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
// back to top links fix | |
html = html.replace( | |
/<strong><a \S+=["']?#((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?.*>(.*)<\/a><\/strong>/gm, | |
(whole, p1, p2) => | |
`<strong><a class="backToTop" href="#${makeUrl( | |
p2 | |
)}-q">${p2}</a></strong>` | |
); |
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 crypto = require("crypto"); | |
module.exports = { | |
onWillParseMarkdown: function (markdown) { | |
return new Promise((resolve, reject) => { | |
return resolve(markdown); | |
}); | |
}, | |
onDidParseMarkdown: function (html, { cheerio }) { | |
return new Promise((resolve, reject) => { |
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
brew install ffmpeg | |
brew install gifsicle | |
ffmpeg -i in.mov -pix_fmt rgb8 -r 10 output.gif && gifsicle -O3 output.gif -o output.gif |
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
/** | |
Walk directory, | |
list tree without regex excludes | |
*/ | |
const fs = require('fs'); | |
const path = require('path'); | |
const fsExtra = require('fs-extra'); | |
const move = (oldPath, newPath, callback) => { | |
fs.rename(oldPath, newPath, err => { |
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
/** | |
* Interval setting control - Better way to manage setInterval and make it easily to destroy | |
*/ | |
export default class Interval { | |
/** | |
* Constructor of interval class - register intervals field here. | |
*/ | |
constructor() { |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.