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
| ### Tuple ### | |
| # Is a collection which is ordered and unchangeable (immutable) | |
| # Uses numerical indexes to access its members. | |
| person = ('Ben', 30, 'male') | |
| print f'Name: {person[0]}, Age: {person[1]}, Gender: {person[2]}' | |
| ### NamedTuple ### | |
| # Exactly like a normal tuple, immutable! |
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
| #!/usr/bin/env python3 | |
| import base64 | |
| import os | |
| import time | |
| from OpenSSL import crypto | |
| import requests | |
| from requests.packages.urllib3 import exceptions as requests_exceptions |
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
| def mergeSort(my_array): | |
| if len(my_array) > 1: | |
| div = len(my_array) // 2 | |
| left_side = mergeSort(my_array[:div]) | |
| right_side = mergeSort(my_array[div:]) | |
| i = 0 | |
| j = 0 | |
| k = 0 | |
| merged_array = [] | |
| while k < len(my_array) and len(left_side) != i and len(right_side) != j: |
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 django.db.models import When | |
| When(is_active=True, then=1) |
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 django.db.models import When, Case, CharField | |
| Book.objects.annotate( | |
| rating=Case( | |
| When(review_score__lte=4, then='Bad Book'), | |
| When(review_score__gte=8, then='Awesome Book'), | |
| default='Average Book', | |
| output_field=CharField() | |
| ) | |
| ) |
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
| option_settings: | |
| - option_name: NODE_ENV | |
| value: production | |
| - option_name: URL | |
| value: http://www.mydomain.com |
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
| production: { | |
| url: process.env.URL, | |
| mail: {}, | |
| database: { | |
| client: 'mysql', | |
| connection: { | |
| host: process.env.RDS_HOSTNAME, | |
| user: process.env.RDS_USERNAME, | |
| password: process.env.RDS_PASSWORD, | |
| database: process.env.RDS_DB_NAME, |