Skip to content

Instantly share code, notes, and snippets.

View JamieVaughn's full-sized avatar
🏗️
make devs

Jamie Vaughn JamieVaughn

🏗️
make devs
  • Altana.ai
  • Rochester, NY
  • 20:45 (UTC -05:00)
View GitHub Profile
@JamieVaughn
JamieVaughn / piping-experiments.js
Created July 5, 2020 05:24 — forked from ducaale/piping-experiments.js
Using ES6 Proxies to turn methods into pipe friendly functions
// .babelrc
// {"plugins": [["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }]]}
const pipeable = (class_) => new Proxy({}, {
get: (target, prop) => (
(prop in class_.prototype)
? (...args) => (receiver) => class_.prototype[prop].call(receiver, ...args)
: class_[prop].bind(class_) // https://stackoverflow.com/a/30819436/5915221
)
});
function genPassword(num = 24, str = '') {
if(num < 8) return 'That password is too weak!'
if(num > 256) return 'Maximum Password length is 256 characters.';
let char = '0123456789abcdefghijklmnopqrstuvwxyz'.split('').filter(a => a !== str[0]).join('')[Math.floor(Math.random() * 36)];
char = Math.random() > 0.65 ? char.toUpperCase() : char;
return str.length < num ? genPassword(num, char + str) : str
}
console.log(genPassword(25, ''))
{
"meta": { "theme": "kendall" },
"basics": {
"name": "W. Jamie Vaughn",
"label": "Frontend Engineer",
"picture": "https://media.licdn.com/dms/image/C4E03AQGHeHEQA7jlWQ/profile-displayphoto-shrink_200_200/0?e=1582761600&v=beta&t=vQsWyBjF_4VO21-19mCQTcC8N8lY-U19Ucv7_h-1v-s",
"summary": "A React and D3 developer who loves the JAMStack",
"website": "https://wjv.io",
"email": "jamie.vaughn4@gmail.com",
"location": {