possibly prevent app from crashing
This commit is contained in:
4
app.js
4
app.js
@ -28,6 +28,7 @@ var connectAssets = require('connect-assets');
|
|||||||
|
|
||||||
var homeController = require('./controllers/home');
|
var homeController = require('./controllers/home');
|
||||||
var challengesController = require('./controllers/challenges')
|
var challengesController = require('./controllers/challenges')
|
||||||
|
var resourcesController = require('./controllers/resources')
|
||||||
var userController = require('./controllers/user');
|
var userController = require('./controllers/user');
|
||||||
var apiController = require('./controllers/api');
|
var apiController = require('./controllers/api');
|
||||||
var contactController = require('./controllers/contact');
|
var contactController = require('./controllers/contact');
|
||||||
@ -120,7 +121,8 @@ app.use(express.static(path.join(__dirname, 'public'), { maxAge: week }));
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
app.get('/', homeController.index);
|
app.get('/', homeController.index);
|
||||||
app.get('/challenges/:challengeNumber', challengesController.returnChallenge)
|
app.get('/challenges/:challengeNumber', challengesController.returnChallenge);
|
||||||
|
app.get('/resources/interview-questions', resourcesController.interviewQuestions);
|
||||||
app.get('/login', userController.getLogin);
|
app.get('/login', userController.getLogin);
|
||||||
app.post('/login', userController.postLogin);
|
app.post('/login', userController.postLogin);
|
||||||
app.get('/logout', userController.logout);
|
app.get('/logout', userController.logout);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* GET /
|
* GET /
|
||||||
* Home page.
|
* Challenges.
|
||||||
*/
|
*/
|
||||||
var Challenge = require('./../models/Challenge')
|
var Challenge = require('./../models/Challenge')
|
||||||
|
|
||||||
@ -13,6 +13,12 @@ exports.returnChallenge = function(req, res) {
|
|||||||
time: c.time,
|
time: c.time,
|
||||||
steps: c.steps,
|
steps: c.steps,
|
||||||
cc: req.user.challengesCompleted
|
cc: req.user.challengesCompleted
|
||||||
|
}, function(err, html) {
|
||||||
|
if(err) {
|
||||||
|
res.redirect('/');
|
||||||
|
} else {
|
||||||
|
res.end(html);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
165
controllers/resources.js
Normal file
165
controllers/resources.js
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
/**
|
||||||
|
* GET /
|
||||||
|
* Resources.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.interviewQuestions = function(req, res) {
|
||||||
|
res.json([
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Accessing Array Index (int a = ARR[5];)",
|
||||||
|
answer: "O(1)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Inserting a node in Linked List",
|
||||||
|
answer: "O(1)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Pushing and Poping on Stack",
|
||||||
|
answer: "O(1)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Insertion and Removal from Queue",
|
||||||
|
answer: "O(1)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Finding out the parent or left/right child of a node in a tree stored in Array",
|
||||||
|
answer: "O(1)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Jumping to Next/Previous element in Doubly Linked List",
|
||||||
|
answer: "O(1)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Traversing an array",
|
||||||
|
answer: "O(n)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Traversing a linked list",
|
||||||
|
answer: "O(n)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Linear Search",
|
||||||
|
answer: "O(n)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Deletion of a specific element in a Linked List (Not sorted)",
|
||||||
|
answer: "O(n)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Comparing two strings",
|
||||||
|
answer: "O(n)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Checking for Palindrome",
|
||||||
|
answer: "O(n)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Counting/Bucket Sort",
|
||||||
|
answer: "O(n)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Binary Search",
|
||||||
|
answer: "O(log n)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Finding largest/smallest number in a binary search tree",
|
||||||
|
answer: "O(log n)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Certain Divide and Conquer Algorithms based on Linear functionality",
|
||||||
|
answer: "O(log n)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Calculating Fibonacci Numbers - Best Method",
|
||||||
|
answer: "O(log n)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Merge Sort",
|
||||||
|
answer: "O(nlogn)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Heap Sort",
|
||||||
|
answer: "O(nlogn)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Quick Sort",
|
||||||
|
answer: "O(nlogn)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Certain Divide and Conquer Algorithms based on optimizing O(n^2) algorithms",
|
||||||
|
answer: "O(nlogn)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Bubble Sort",
|
||||||
|
answer: "O(n^2)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Insertion Sort",
|
||||||
|
answer: "O(n^2)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Selection Sort",
|
||||||
|
answer: "O(n^2)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Time Complexity of Traversing a simple 2D array",
|
||||||
|
answer: "O(n^2)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of L1 cache reference",
|
||||||
|
answer: "0.5 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of Branch mispredict",
|
||||||
|
answer: "5 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of L2 cache reference",
|
||||||
|
answer: "7 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of Mutex lock/unlock",
|
||||||
|
answer: "25 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of Main memory reference",
|
||||||
|
answer: "100 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of Compressing 1K bytes with Zippy",
|
||||||
|
answer: "3,000 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of Sending 1K bytes over a 1 Gbps network",
|
||||||
|
answer: "10,000 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of Reading 4K randomly from SSD",
|
||||||
|
answer: "150,000 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of Reading 1 MB sequentially from memory",
|
||||||
|
answer: "250,000 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of a Round trip within the same datacenter",
|
||||||
|
answer: "500,000 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of Reading 1 MB sequentially from SSD",
|
||||||
|
answer: "1,000,000 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of Disk seek",
|
||||||
|
answer: "10,000,000 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of Reading 1 MB sequentially from disk",
|
||||||
|
answer: "20,000,000 nanoseconds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Latency of Sending a packet from California to the Netherlands and back",
|
||||||
|
answer: "150,000,000 nanoseconds"
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
};
|
@ -33,54 +33,54 @@
|
|||||||
li
|
li
|
||||||
a(href="/challenges/14", class="#{ cc.indexOf(14) > -1 ? 'strikethrough' : '' }") Codecademy's JavaScript track
|
a(href="/challenges/14", class="#{ cc.indexOf(14) > -1 ? 'strikethrough' : '' }") Codecademy's JavaScript track
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/15", class="#{ cc.indexOf(15) > -1 ? 'strikethrough' : '' }") Get Help The Hacker Way with RSAP
|
a(href="/challenges/15", class="#{ cc.indexOf(15) > -1 ? 'strikethrough' : '' }") Get Help The Hacker Way with RSAP
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/16", class="#{ cc.indexOf(16) > -1 ? 'strikethrough' : '' }") Easy Algorithm Scripting Challenges on Coderbyte
|
a(href="/challenges/17", class="#{ cc.indexOf(17) > -1 ? 'strikethrough' : '' }") Stanford's Introduction to Computer Science
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/17", class="#{ cc.indexOf(17) > -1 ? 'strikethrough' : '' }") Harvard's CS50: Introduction to Computer Science
|
a(href="/challenges/16", class="#{ cc.indexOf(16) > -1 ? 'strikethrough' : '' }") Easy Algorithm Scripting Challenges on Coderbyte
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/18", class="#{ cc.indexOf(18) > -1 ? 'strikethrough' : '' }") Medium Algorithm Scripting Challenges on Coderbyte
|
a(href="/challenges/19", class="#{ cc.indexOf(19) > -1 ? 'strikethrough' : '' }") Stanford's Relational Databases Mini-course
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/19", class="#{ cc.indexOf(19) > -1 ? 'strikethrough' : '' }") Stanford's Relational Databases Mini-course
|
a(href="/challenges/23", class="#{ cc.indexOf(23) > -1 ? 'strikethrough' : '' }") Stanford's SQL Mini-course
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/20", class="#{ cc.indexOf(20) > -1 ? 'strikethrough' : '' }") Stanford's JSON Mini-course
|
a(href="/challenges/20", class="#{ cc.indexOf(20) > -1 ? 'strikethrough' : '' }") Stanford's JSON Mini-course
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/21", class="#{ cc.indexOf(21) > -1 ? 'strikethrough' : '' }") Build a Text-based Adventure
|
a(href="/challenges/18", class="#{ cc.indexOf(18) > -1 ? 'strikethrough' : '' }") Medium Algorithm Scripting Challenges on Coderbyte
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/22", class="#{ cc.indexOf(22) > -1 ? 'strikethrough' : '' }") Hard Algorithm Scripting Challenges on Coderbyte
|
a(href="/challenges/24", class="#{ cc.indexOf(24) > -1 ? 'strikethrough' : '' }") Build an Interview Question Machine
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/23", class="#{ cc.indexOf(23) > -1 ? 'strikethrough' : '' }") Stanford's SQL Mini-course
|
a(href="/challenges/21", class="#{ cc.indexOf(21) > -1 ? 'strikethrough' : '' }") Build a Text-based Adventure
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/24", class="#{ cc.indexOf(24) > -1 ? 'strikethrough' : '' }") Build an Interview Question Machine
|
a(href="/challenges/22", class="#{ cc.indexOf(22) > -1 ? 'strikethrough' : '' }") Hard Algorithm Scripting Challenges on Coderbyte
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/25", class="#{ cc.indexOf(25) > -1 ? 'strikethrough' : '' }") Code School's Try Git
|
a(href="/challenges/25", class="#{ cc.indexOf(25) > -1 ? 'strikethrough' : '' }") Code School's Try Git
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/26", class="#{ cc.indexOf(26) > -1 ? 'strikethrough' : '' }") Install Node.js
|
a(href="/challenges/26", class="#{ cc.indexOf(26) > -1 ? 'strikethrough' : '' }") Install Node.js
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/27", class="#{ cc.indexOf(27) > -1 ? 'strikethrough' : '' }") Clone a Github Repo
|
a(href="/challenges/27", class="#{ cc.indexOf(27) > -1 ? 'strikethrough' : '' }") Clone a Github Repo
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/28", class="#{ cc.indexOf(28) > -1 ? 'strikethrough' : '' }") Deploy an app to Heroku
|
a(href="/challenges/28", class="#{ cc.indexOf(28) > -1 ? 'strikethrough' : '' }") Deploy an app to Heroku
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/29", class="#{ cc.indexOf(29) > -1 ? 'strikethrough' : '' }") Code School's Real-time web with Node.JS
|
a(href="/challenges/29", class="#{ cc.indexOf(29) > -1 ? 'strikethrough' : '' }") Code School's Real-time web with Node.JS
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/30", class="#{ cc.indexOf(30) > -1 ? 'strikethrough' : '' }") Try MongoDB
|
a(href="/challenges/30", class="#{ cc.indexOf(30) > -1 ? 'strikethrough' : '' }") Try MongoDB
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/31", class="#{ cc.indexOf(31) > -1 ? 'strikethrough' : '' }") Explore your Network with the LinkedIn API
|
a(href="/challenges/31", class="#{ cc.indexOf(31) > -1 ? 'strikethrough' : '' }") Explore your Network with the LinkedIn API
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/32", class="#{ cc.indexOf(32) > -1 ? 'strikethrough' : '' }") Build your first API
|
a(href="/challenges/32", class="#{ cc.indexOf(32) > -1 ? 'strikethrough' : '' }") Build your first API
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/33", class="#{ cc.indexOf(33) > -1 ? 'strikethrough' : '' }") Aggregate Data with Chron Jobs and Screen Scraping
|
a(href="/challenges/33", class="#{ cc.indexOf(33) > -1 ? 'strikethrough' : '' }") Aggregate Data with Chron Jobs and Screen Scraping
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/34", class="#{ cc.indexOf(34) > -1 ? 'strikethrough' : '' }") Code School's Shaping up with Angular.JS
|
a(href="/challenges/34", class="#{ cc.indexOf(34) > -1 ? 'strikethrough' : '' }") Code School's Shaping up with Angular.JS
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/35", class="#{ cc.indexOf(35) > -1 ? 'strikethrough' : '' }") Reverse Engineer SnapChat
|
a(href="/challenges/35", class="#{ cc.indexOf(35) > -1 ? 'strikethrough' : '' }") Reverse Engineer SnapChat
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/36", class="#{ cc.indexOf(36) > -1 ? 'strikethrough' : '' }") Reverse Engineer Reddit
|
a(href="/challenges/36", class="#{ cc.indexOf(36) > -1 ? 'strikethrough' : '' }") Reverse Engineer Reddit
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/37", class="#{ cc.indexOf(37) > -1 ? 'strikethrough' : '' }") Reverse Engineer Pintrest
|
a(href="/challenges/37", class="#{ cc.indexOf(37) > -1 ? 'strikethrough' : '' }") Reverse Engineer Pintrest
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/38", class="#{ cc.indexOf(38) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Team Project
|
a(href="/challenges/38", class="#{ cc.indexOf(38) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Team Project
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/39", class="#{ cc.indexOf(39) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Solo Project
|
a(href="/challenges/39", class="#{ cc.indexOf(39) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Solo Project
|
||||||
li
|
li
|
||||||
a.disabled(href="/challenges/40", class="#{ cc.indexOf(40) > -1 ? 'strikethrough' : '' }") Crack the Coding Interview
|
a(href="/challenges/40", class="#{ cc.indexOf(40) > -1 ? 'strikethrough' : '' }") Crack the Coding Interview
|
Reference in New Issue
Block a user