This file contains hidden or 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
// Don't Do this | |
let input = document.getElementById('input'); | |
// Checks to see if input is valid. | |
if (input.value != ''){ | |
callFunction(); | |
} | |
// Do this instead | |
let input = document.getElementById('input'); | |
let isValidInput = input.value != ''; |
This file contains hidden or 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
function validateTextInput(){ | |
// checks all text inputs to make sure they are not empty. | |
} |
This file contains hidden or 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
function addFive(){ | |
// Setup - Declare all variables that I will need. | |
let inputNumber, newNumber; | |
// Input - Handle any user input. | |
inputText = prompt('Enter a numerical value'); | |
// Transform - Compute any values once I have all dependencies. | |
newNumber = inputNumber + 5; | |
This file contains hidden or 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
#!/bin/sh | |
agr () { | |
# find and replace | |
regex=s/${1}/${2}/g; | |
ag $1 -l | xargs sed -i.agr_backup $regex; | |
# delete backups | |
ag -G .agr_backup -l | xargs rm | |
} |