Skip to content

Instantly share code, notes, and snippets.

View sayjeyhi's full-sized avatar
:electron:
Building things

Jafar Rezaei sayjeyhi

:electron:
Building things
View GitHub Profile

title: "مجموعه سوالات استخدامی ری‌اکت react.js" author: JafarRezaei date: August 30, 2020 export_on_save: html: true puppeteer: landscape: false printBackground: true timeout: 3000

// 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>
// 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`)
);
// 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>`
);
@sayjeyhi
sayjeyhi / headings.js
Last active September 10, 2020 17:38
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) => {
brew install ffmpeg
brew install gifsicle
ffmpeg -i in.mov -pix_fmt rgb8 -r 10 output.gif && gifsicle -O3 output.gif -o output.gif
/**
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 => {
/**
* 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() {
@sayjeyhi
sayjeyhi / tmux-cheatsheet.markdown
Created April 12, 2020 09:50 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.