Skip to content

Instantly share code, notes, and snippets.

View ahmad-ali14's full-sized avatar
🤔

Ahmad Ali ahmad-ali14

🤔
View GitHub Profile
@ahmad-ali14
ahmad-ali14 / tsconfig.json
Created February 18, 2024 06:49 — forked from mtimbs/tsconfig.json
basic default tsconfig for use in TypeScript projects
{
"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)

run ngrok with tls

ngrok http -bind-tls=true localhost:3000
@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",
# 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.
"""
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:
"""
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
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) {
//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');
//DB and authentication
mongo.connect(process.env.DATABASE, (err, cluster) => {
if(err) {
console.log('Database error: ' + err);
} else {
mongo.connect(process.env.DATABASE_URL, (err, db) => {
if(err) {
console.log(‘Database error: ‘ + err);
} else {
console.log(‘Successful database connection’);