Skip to content

Instantly share code, notes, and snippets.

View ahmad-ali14's full-sized avatar
🤔

Ahmad Ali ahmad-ali14

🤔
View GitHub Profile
  1. first, move cmder folder to the main root c:// drive.
  2. make file enable.reg and paste this code in it (make it in vscode):
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
@="Open in Cmder"
"Icon"="C:\\Cmder\\Cmder.exe,0"
mongo.connect(process.env.DATABASE_URL, (err, db) => {
if(err) {
console.log(‘Database error: ‘ + err);
} else {
console.log(‘Successful database connection’);
//DB and authentication
mongo.connect(process.env.DATABASE, (err, cluster) => {
if(err) {
console.log('Database error: ' + err);
} else {
//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');
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) {
"""
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
"""
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:
# 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.
@ahmad-ali14
ahmad-ali14 / settings.md
Last active January 26, 2021 14:45
golang - project settings vscode

settings for golang project in vs code

  • put those in .vscode folder/settings.json
{
    "editor.defaultFormatter": "golang.go",
    "editor.formatOnPaste": true,
    "editor.formatOnSave": true,
 "go.formatTool": "gofmt",

run ngrok with tls

ngrok http -bind-tls=true localhost:3000