Skip to content

Instantly share code, notes, and snippets.

View piontekle's full-sized avatar

Lauren Piontek piontekle

View GitHub Profile
:~ piontekle$ createdb -U postgres -w library
:~ piontekle$ psql -f bloc/database_module_bloc/library-data.sql library postgres
CREATE TABLE
INSERT 0 4
:~ piontekle$ psql library postgres
psql (11.1)
Type "help" for help.
library=# SELECT * FROM books;
id | title | author
@piontekle
piontekle / gist:24e3c3eb46b45ea8f27da236008f64f2
Last active March 1, 2019 19:06
Test Error in Bloccit Checkpoint 5 Topic Resource Pt 1
2019-03-01 13:46:08.314 EST [64814] ERROR: relation "Topics" does not exist at character 68
2019-03-01 13:46:08.314 EST [64814] STATEMENT: SELECT "id", "title", "description", "createdAt", "updatedAt" FROM "Topics" AS "Topic";
F
Failures:
1) routes : topics GET /topics should return a status code 200 and all topics
Message:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Stack:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
:bloccit piontekle$ npm test
> bloccit@1.0.0 test /Users/piontekle/bloc/bloccit
> export NODE_ENV=test && jasmine
Started
server is listening for requests on port 3000
...2019-03-01 14:27:13.754 EST [65268] ERROR: relation "Topic" does not exist
2019-03-01 14:27:13.754 EST [65268] STATEMENT: CREATE TABLE IF NOT EXISTS "Banners" ("id" SERIAL , "source" VARCHAR(255), "description" VARCHAR(255), "topicId" INTEGER REFERENCES "Topic" ("id") ON DELETE CASCADE ON UPDATE CASCADE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, PRIMARY KEY ("id"));
Unhandled rejection SequelizeDatabaseError: relation "Topic" does not exist
DEBUG: ERROR at 'topicController#index'
{ SequelizeDatabaseError: relation "Topics" does not exist
at Query.formatError (/Users/piontekle/bloc/bloccit/node_modules/sequelize/lib/dialects/postgres/query.js:363:16)
at query.catch.err (/Users/piontekle/bloc/bloccit/node_modules/sequelize/lib/dialects/postgres/query.js:86:18)
at tryCatcher (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:690:18)
at _drainQueueStep (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/async.js:138:12)
@piontekle
piontekle / gist:aa643d2ab78c9dd60d0b06f675d2ab28
Created March 13, 2019 18:14
Authorization New Post Error
TypeError: Class constructor ApplicationPolicy cannot be invoked without 'new'
at new (/Users/piontekle/bloc/bloccit/src/controllers/postController.js:7:24)
at Layer.handle [as handle_request] (/Users/piontekle/bloc/bloccit/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/piontekle/bloc/bloccit/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/Users/piontekle/bloc/bloccit/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/Users/piontekle/bloc/bloccit/node_modules/express/lib/router/layer.js:95:5)
at /Users/piontekle/bloc/bloccit/node_modules/express/lib/router/index.js:281:22
at param (/Users/piontekle/bloc/bloccit/node_modules/express/lib/router/index.js:354:14)
at param (/Users/piontekle/bloc/bloccit/node_modules/express/lib/router/index.js:365:14)
at Function.process_params (/Users/piontekle/bloc/bloccit/node_modules/express/lib/router/index.js:410:3)
@piontekle
piontekle / gist:17eea090c981d281c7a1babb6609afcc
Last active March 14, 2019 21:21
Assignment 14 getPoints() undefined
Started
server is listening for requests on port 3000
.....VOTE:
Vote {
dataValues:
{ id: 1,
value: 1,
postId: 1,
userId: 1,
createdAt: 2019-03-14T21:20:25.302Z,
Unhandled rejection TypeError: Cannot read property 'wiki' of undefined
at wikiQueries.getWiki (/Users/piontekle/bloc/bloccipedia/src/controllers/wikiController.js:82:24)
at Collaborator.scope.findAll.then.catch (/Users/piontekle/bloc/bloccipedia/src/db/queries.wikis.js:31:11)
at tryCatcher (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/promise.js:690:18)
at _drainQueueStep (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/Users/piontekle/bloc/blocci
//Fizzbuzz
for (i=1; i<=100; i++) {
if (i%15 === 0) console.log ("FizzBuzz");
else if (i%3 === 0) console.log ("Fizz");
else if (i%5 === 0) console.log("Buzz");
else console.log(i);
}
//*********************************************************************************************
//Subarray Sum Equals K
//Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.
handleSubmit(e) {
e.preventDefault();
const { url, name, email, subject, message } = this.state;
axios.post(`${url}/sendMail`, {
name,
email,
subject,
message
})
.then((res) => {
=begin
Given an array, find the int that appears an odd number of times.
There will always be only one integer that appears an odd number of times.
967 ms
=end
def find_it(seq)
#your code here
counts = Hash.new(0)