Skip to content

Instantly share code, notes, and snippets.

View GarthStevens5's full-sized avatar

Garth Stevens GarthStevens5

View GitHub Profile
in cli for local db
-Install postgres (one time only for the psql cli tools)
-Install pg in the working folder of code(postgres for node) npm install pg
-createdb nameofdb
-Install knex in the working folder of code npm install knex (-g first time)
-knex init (gives you the knexfile -see below)
-knex migrate:make 'nameofmigrationsfile' <-- then edit
-knex migrate:latest
-optional for seeding- knex seed:make 'nameofseedfile' <--then edit
@GarthStevens5
GarthStevens5 / allOccurenceOfInt.js
Last active April 28, 2018 18:39
JS Check for all Odd occurrences of an integer.
function findOdd(A) {
var num;
var count = 0;
for(i=0;i<A.length;i++){
num = A[i]
for(a=0;a,a<A.length;a++){
if(A[a]==num){
count++;
}
} if(count%2!=0){