Skip to content

Instantly share code, notes, and snippets.

View themarcba's full-sized avatar

Marc Backes themarcba

View GitHub Profile
@themarcba
themarcba / accept-x-community-requests.js
Last active January 5, 2024 10:19
Accept all requests on an 𝕏 community
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);
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
@themarcba
themarcba / new_branch_bugfix.sh
Created January 24, 2022 13:47
Short commands to pull the current branch and create a new branch from it
#!/usr/bin/env zsh
source ~/.zshrc
ggpull
gco -b "bugfix/$1"

Stupid puns. Don't Laugh!

Tech puns

  • 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.
// 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 => {
// 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({
const sleepSort = arr => {
arr.forEach(n => {
setTimeout(() => console.log(n), n * 1000)
})
}
sleepSort([5, 7, 1, 2])
#################################################################
# 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"
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
@themarcba
themarcba / toSarcasm.js
Created February 8, 2021 10:36
Convert any text in "sarcasm text"
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