- Why did the Vue child component have such great self-esteem? Because its parent kept giving it props!
- What does a Vue developer have in his tea? Syntactic sugar
- Programming is like sex: One mistake and you have to support it for the rest of your life.
- Sometimes when I'm writing JavaScript I want to throw up my hands and say "this is bullshit!" but I can never remember what "this" refers to.
- Why are JavaScript conferences the worst? It all just sounds scripted.
- How do you comfort a JavaScript bug? a. You console it.
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 acceptInterval = setInterval(() => { | |
const acceptButtons = Array.from(document.querySelectorAll("[role=button]")).filter( | |
(button) => button.textContent === "Approve" | |
); | |
if (acceptButtons.length > 0) { | |
acceptButtons.forEach((b) => b.click()); | |
window.scrollBy(0, window.innerHeight - 100); | |
} else { | |
clearInterval(acceptInterval); |
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
npm init vue@3 | |
if [ $? -eq 0 ]; then | |
LAST_FOLDER=$(ls -td ./* | head -1) | |
cd $LAST_FOLDER | |
yarn | |
code . | |
else | |
echo "Project creation unsuccessful 😔" | |
fi |
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
#!/usr/bin/env zsh | |
source ~/.zshrc | |
ggpull | |
gco -b "bugfix/$1" |
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
// A dependency-free, await-ready function for Node.js | |
// to get user input in the console | |
// Author: Marc Backes (@themarcba | |
const getInput = query => { | |
return new Promise((resolve, reject) => { | |
const readline = require('readline').createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
}) | |
readline.question(`${query} `, answer => { |
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
// Standalone, dependency-free version of rock paper scissors | |
// Author: Marc Backes (@themarcba) | |
// Available choices and it's associated values | |
const choiceMap = { r: 'rock', p: 'paper', s: 'scissors' } | |
// Request an input from the user | |
const getInput = query => { | |
return new Promise((resolve, reject) => { | |
const readline = require('readline').createInterface({ |
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 sleepSort = arr => { | |
arr.forEach(n => { | |
setTimeout(() => console.log(n), n * 1000) | |
}) | |
} | |
sleepSort([5, 7, 1, 2]) |
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
################################################################# | |
# Marc's LAZY code-related aliases (some might require oh-my-zsh) | |
################################################################# | |
# For lazy commits | |
alias c="git commit -m" | |
# Lazy access to yarn | |
alias y="yarn" |
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
if [[ "$*" == "whiskey" || "$*" == "whiskey wednesday" ]]; then | |
MESSAGE="Whiskey and coding, what can go wrong? Cheers! 🙌" | |
PREFIX='🥃' | |
elif [[ "$*" == "beer" || "$*" == "happy hour" ]]; then | |
MESSAGE='Cheers 🍻' | |
PREFIX='🍺' | |
elif [[ "$*" == "frontend" || "$*" == "fe" ]]; then | |
MESSAGE='' | |
PREFIX='🎨' | |
elif [[ "$*" == "backend" || "$*" == "be" ]]; then |
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 toRandom = c => Math.random() > 0.5 ? c.toUpperCase() : c.toLowerCase() | |
const toSarcasm = text => text.split('').map(c => toRandom(c)).join('') | |
console.log(toSarcasm('This is a sarcastic message')); //ThIS Is A SarcAstiC mesSAgE |
NewerOlder