Skip to content

Instantly share code, notes, and snippets.

View Thorn51's full-sized avatar

Matt Thornberry Thorn51

  • Free Agent
  • Denver, Colorado
View GitHub Profile

Postgres Command Line

  • postgres=# -> indicates that we are in the psql shell
  • $ -> indicates that we are in the bash shell

Bash terminal

  • $ psql -> connect to server to enter postgres=# 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
@Thorn51
Thorn51 / Average
Created June 13, 2019 20:31
Thinkful drill for Loops and Arrays module
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 :)
@Thorn51
Thorn51 / Accessing Array Items
Last active June 12, 2019 19:06
Drills in the Thinkful JavaScript module for arrays
function accessFirstItem(array) {
return array[0];
}
function accessThirdItem(array) {
return array[2];
}
/* From here down, you are not expected to
understand.... for now :)
@Thorn51
Thorn51 / Application Logic - Error (Try Catch)
Created June 11, 2019 20:31
Two drills from the application logic section of the JavaScript module. One drill for try/catch, and another for if statements.
function main() {
try {
doAllTheThings();
}
catch(e) {
console.error(e);
reportError(e);
}
}
@Thorn51
Thorn51 / Divisible
Last active June 10, 2019 22:24
Thinkful JavaScript Numbers
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!
@Thorn51
Thorn51 / Normalizer
Last active June 10, 2019 19:38
Thinkful JavaScript String Drills
function textNormalizer(text) {
return `${text.toLowerCase().slice(3,48)}`;
}
/* From here down, you are not expected to
understand.... for now :)
Nothing to see here!