-
Single-line comments are started with
//
. Multi-line comments are started with/*
and ended with*/
. -
C# uses braces (
{
and}
) instead of indentation to organize code into blocks. If a block is a single line, the braces can be omitted. For example,
This file contains 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
import 'dart:io' show Platform; | |
import 'package:flutter/foundation.dart' show kIsWeb; | |
import 'package:english_words/english_words.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/cupertino.dart'; |
-
Single-line comments are started with
//
. Multi-line comments are started with/*
and ended with*/
. -
C# uses braces (
{
and}
) instead of indentation to organize code into blocks. If a block is a single line, the braces can be omitted. For example,
This file contains 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
from fastapi import FastAPI | |
apiv1 = FastAPI() | |
@apiv1.get('/returnName') | |
def index(): | |
return {"Name": "Kaustubh demo"} | |
################# |
This file contains 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
from models.item import Item | |
from json import dumps | |
from pika import ( | |
BlockingConnection, | |
ConnectionParameters, | |
BasicProperties | |
) | |
async def register_item_service(item:dict)->Item: |
This file contains 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
from typing import Optional | |
import base64 | |
from passlib.context import CryptContext | |
from datetime import datetime, timedelta | |
import jwt | |
from jwt import PyJWTError | |
from pydantic import BaseModel |
This file contains 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
import functools | |
def compose(*functions): | |
return functools.reduce(lambda f, g: lambda x: f(g(x)), functions) | |
# dec double inc are given function | |
>>> inc_double_and_dec = compose(dec, double, inc) |
This file contains 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
/* | |
Middlewares provide us with the ability to intercept actions and do something we want to before that action reaches the reducers. We can log actions, log store state, log crash reports, etc. | |
Let's create a middleware for logging actions when they get dispatched. | |
*/ | |
const logger = (store) => (next) => (action) => { | |
console.log("DISPATCHED ACTION: ", action); | |
next(action); | |
} |
This file contains 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 INCREMENT = "INCREMENT"; // define a constant for increment action types | |
const DECREMENT = "DECREMENT"; // define a constant for decrement action types | |
// define the counter reducer which will increment or decrement the state based on the action it receives | |
const counterReducer = (state = 0, action) => { | |
switch (action.type) { | |
case INCREMENT: | |
return state + 1; | |
case DECREMENT: |
NewerOlder