ngrok http -bind-tls=true localhost:3000
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
// project options | |
"lib": [ | |
"ESNext", | |
"dom" | |
], // specifies which default set of type definitions to use ("DOM", "ES6", etc) | |
"outDir": "lib", // .js (as well as .d.ts, .js.map, etc.) files will be emitted into this directory., | |
"removeComments": true, // Strips all comments from TypeScript files when converting into JavaScript- you rarely read compiled code so this saves space | |
"target": "ES6", // Target environment. Most modern browsers support ES6, but you may want to set it to newer or older. (defaults to ES3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# count from a postive num descinding dwon to 0. | |
def countdown(n): | |
# base case | |
if n <= 0: | |
print('Blastoff!') | |
else: | |
print(n) | |
countdown(n-1) | |
# count from a negative num ascending up to 0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Describe the difference between a chained conditional and a nested conditional. Give your own example of each. Do not copy examples from the textbook. | |
Well, chained conditionals are usually at the same level, that means we have only one level of branching _main_ >> ( if - elif -else) | |
While the nested conditionals contain multiple levels of branching, __main__ >> first_level of branching ( if >> second_level_of_branching( if >> third_level … -elif-else ) - elif - else ) | |
""" | |
# example of chained condition: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Part 1 | |
rite a function called print_volume (r) that takes an argument for the radius of the sphere, and prints the volume of the sphere. | |
Call your print_volume function three times with different values for radius. | |
""" | |
# define a constant variable PI | |
PI = 3.141592653589793 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
app.use(bodyParser.json()) | |
const quotes = require("./quotes.json"); | |
app.get('/', function(request, response) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//DB and authentication | |
mongo.connect(process.env.DATABASE_URL, (err, cluster) => { | |
if(err) { | |
console.log('Database error: ' + err); | |
} else { | |
// 1- connecting to the cluster | |
console.log('Successful database connection'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//DB and authentication | |
mongo.connect(process.env.DATABASE, (err, cluster) => { | |
if(err) { | |
console.log('Database error: ' + err); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongo.connect(process.env.DATABASE_URL, (err, db) => { | |
if(err) { | |
console.log(‘Database error: ‘ + err); | |
} else { | |
console.log(‘Successful database connection’); |
NewerOlder