- Access the developer console https://console.developers.google.com
- Create a new project
- In APIs and Oauth section:
a. In APIs section - enable gmail api
b. In Credentials section -
1. Click Create new client ID
2. Fill email and project name
3. Save
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
######### using python mongoengine | |
min_age = Customer.objects(zip_code = 687218).order_by("age").first().age | |
max_age = Customer.objects(zip_code = 687218).order_by("-age").first().age | |
######### using mongo client commands | |
#MIN | |
db.customers.find({"zip_code":683749}).sort( { age: 1 } ).limit(-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
extension Dictionary { | |
func get(key: Key, defaultValue: Value) -> Value { | |
/** | |
Returns the value for the given key (if exists), otherwise returns the default value. | |
*/ | |
if let value = self[key] { | |
return value | |
} else { |
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
########## CASE IN UPDATE STATEMENT ############ | |
from sqlalchemy import case | |
# single value modification (the 'else' is not mandatory) | |
session.query(User).update({User.status : case([(User.status == "pending", "approved")], else_=User.status)}, False) | |
# multiple values modification | |
session.query(User).update({User.status : case([(User.status == "pending", "approved"), | |
(User.status == "waiting", "deprecated_status")])}, False) |