Skip to content

Instantly share code, notes, and snippets.

View teksrc's full-sized avatar
🛫
deploy

Frank Carvajal teksrc

🛫
deploy
View GitHub Profile
1) Get all the restaurants.
Write a query that returns all of the restaurants, with all of the fields.
knex.select('id', 'name', 'borough', 'cuisine')
.from('restaurants')
.then(results => console.log(JSON.stringify(results, null, 4)));
2) Get Italian restaurants
Write a query that returns all of the Italian restaurants, with all of the fields
@teksrc
teksrc / PostgreSQL
Last active March 27, 2017 19:54
SQL Basic Drills
1) Get all the restaurants.
Write a query that returns all of the restaurants, with all of the fields.
SELECT * FROM restaurants;
2) Get Italian restaurants
Write a query that returns all of the Italian restaurants, with all of the fields
SELECT * FROM restaurants WHERE cuisine = 'Italian';
DOCUMENTATION
mongoDB Query and Projection Operators
https://docs.mongodb.com/v3.2/reference/operator/query/
mongoDB Shell Methods
https://docs.mongodb.com/v3.2/reference/method/#collection
1) Build a query to filter the data set. Find all of the restaurants which have:
@teksrc
teksrc / MongoDB Basic Drills
Created March 20, 2017 17:19
In these drills, we practiced executing CRUD (create, read, update, delete) operations in the Mongo shell.
Get all
db.restaurants.find();
Limit and sort
db.restaurants.
find().
@teksrc
teksrc / Server Side JavaScript Fundamentals
Last active March 13, 2017 21:58
Mad lib generator & A/B Test Req/Res JS Drills
Request & Response Drills:
- Mad Lib Generator
https://glitch.com/edit/#!/project/sequoia-windshield
Q's for Mentor: 1. Discuss the code format.
- A/B Test
http://jsbin.com/yidatujole/edit?js,console,output
Retouch definitions of Unit 1 & 2
Most frequent word:
https://jsbin.com/bebedun/edit?js,console
Data merge:
https://jsbin.com/nocote/edit?js,console
Recipe Factory:
https://jsbin.com/wasupoz/edit?js,output
Object Creator :
https://jsbin.com/xacoqun/edit?js,console
Object updater:
https://jsbin.com/qenowa/edit?js,console
Self reference:
https://jsbin.com/vurugis/edit?js,console
Deleting keys:
Questions:
1. What is scope? Your explanation should include the idea of global vs. local scope.
2. Why are global variables avoided?
3. Explain JavaScript's strict mode
4. What are side effects, and what is a pure function?
5. Explain variable hoisting in JavaScript.
1. Scope is what determines which parts of the code can access certain variables
Global vs. local: Global scope is everywhere and is declared outside of a function.