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
| import base64 | |
| import math | |
| from typing import Dict | |
| import jwt | |
| from cursor_pagination import CursorPaginator | |
| from django.conf import settings | |
| from django.utils import timezone | |
| def paginate(queryset, pagination_input: Dict = None): |
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
| from __future__ import annotations | |
| from datetime import datetime | |
| from copy import deepcopy | |
| from typing import Any | |
| class Prototype: | |
| """ | |
| The example class that has cloning ability. We'll see how the values of | |
| field with different types will be cloned. |
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
| addi $t0, $s6, 4 | |
| add $t1, $s6, $s0 | |
| sw $t1, 0($t0) | |
| lw $t0, 0($t0) | |
| add $s0, $t1, $t0 |
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
| from __future__ import annotations | |
| from abc import ABC, abstractmethod | |
| class AbstractPizzaStore(ABC): | |
| @abstractmethod | |
| def create_pizza(self) -> AbstractPizza: | |
| """ | |
| This is factory method |
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
| from __future__ import annotations | |
| from abc import ABC, abstractmethod, abstractproperty | |
| from typing import Any | |
| class AbstractHouseBuilder(ABC): | |
| """ | |
| This Builder interface specifies methods for creating the different parts of | |
| the house. | |
| """ |
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
| from __future__ import annotations | |
| from abc import ABC, abstractmethod | |
| class AbstractChairFactory(ABC): | |
| @abstractmethod | |
| def create_chair(self) -> AbstractChair: | |
| pass |
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
| \\ Further exaMPles af pointers | |
| Main () | |
| { | |
| char c = 'Q'; | |
| char *char_pointer = &c; | |
| printf("%c %c\n", c, *char_pointer); | |
| c ='/'; | |
| printf("%c %c\n", c, *char_pointer); |
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
| //Program to illustrate pointers | |
| Main () | |
| { | |
| int count = 10; | |
| int *int_pointer; // Pointer-to-integer | |
| int_pointer = &count; // Assign address of count to int_pointer | |
| int x = *int_pointer; // Variable int_pointer contains a pointer to count. This pointer is used to access the data item in count. | |
| printf("count = %d, x = %d\n", count, x); | |
| } |
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
| int x = *int_pointer; |
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
| int_pointer = &count; |
NewerOlder