Design patterns are utilized to structure code in an optimized manner to help solve commonly occuring software problems.
postgres=#
-> indicates that we are in the psql shell$
-> indicates that we are in the bash shell
$ psql
-> connect to server to enterpostgres=#
prompt$ createuser -Pw --interactive
-> Interactive user creation, follow prompts to create name, password, attributes$ createdb -U <user_name> <databse_name>
-> Creates a database and assigns owner with -U flag, user must exist$ dropuser <name>
-> removes user from server$ dropdb
-> removes database from server
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 average(numbers) { | |
let total = 0; | |
for (let i = 0; i < numbers.length; i++) { | |
total += numbers[i] | |
} | |
return total/numbers.length; | |
} | |
/* From here down, you are not expected to | |
understand.... for now :) |
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 accessFirstItem(array) { | |
return array[0]; | |
} | |
function accessThirdItem(array) { | |
return array[2]; | |
} | |
/* From here down, you are not expected to | |
understand.... for now :) |
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 main() { | |
try { | |
doAllTheThings(); | |
} | |
catch(e) { | |
console.error(e); | |
reportError(e); | |
} | |
} |
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 isDivisible(divisee, divisor) { | |
if (divisee % divisor === 0) return true; | |
else return false; | |
} | |
/* From here down, you are not expected to | |
understand.... for now :) | |
Nothing to see here! |
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 textNormalizer(text) { | |
return `${text.toLowerCase().slice(3,48)}`; | |
} | |
/* From here down, you are not expected to | |
understand.... for now :) | |
Nothing to see here! | |