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
// https://ahmedelwerdany.github.io/posts/watch-many-in-vue-js/ | |
function watchMany (arrayOfKeys, value) { | |
const object = {} | |
for (let i = 0; i < arrayOfKeys.length; i++) { | |
object[arrayOfKeys[i]] = value | |
} | |
return object | |
} |
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 { execSync } from 'child_process'; | |
import path from 'path'; | |
function roundImage(src_path, dest_path,radius = 15){ | |
const {w,h} = getSize(src_path) | |
const maskName = `mask.png` | |
execSync(`convert -size ${w}x${h} xc:none -draw "roundrectangle 0,0,${w},${h},${radius},${radius}" ${maskName}`) | |
execSync(`convert ${src_path} -matte ${maskName} -compose DstIn -composite ${dest_path}`) | |
} |
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
/* | |
* <div id='element'>hello world <span>!</span></div> | |
* | |
*/ | |
const element = document.querySelector('#element'); | |
let result = ''; | |
element.childNodes.forEach(child => { |