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
function createCSV(data) { | |
var lineDelimiter = '\n'; | |
var csv = { | |
'title': '', | |
'head': '', | |
'body': '' | |
}; | |
csv.title = 'csv-title.csv'; | |
csv.head = '...'; // make your own csv head |
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
# -*- coding: utf-8 -*- | |
import hashlib | |
import boto3 | |
class ETSManager: | |
""" | |
@todo: manages and provides the ets services |
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
# config.py | |
class Config: | |
APP_NAME = 'myapp' | |
SECRET_KEY = 'secret-key-of-myapp' | |
ADMIN_NAME = 'administrator' | |
AWS_DEFAULT_REGION = 'ap-northeast-2' | |
STATIC_PREFIX_PATH = 'static' | |
ALLOWED_IMAGE_FORMATS = ['jpg', 'jpeg', 'png', 'gif'] |
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
# -*- coding: utf-8 -*- | |
import StringIO | |
import math | |
import boto3 | |
# custom hash function that hashes the filename | |
from generator import generate_file_hash |
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
def save_ranking(**kwargs, *args): | |
... |
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
def save_ranking(*args, **kwargs): | |
print(args) | |
print(kwargs) | |
save_ranking('ming', 'alice', 'tom', fourth='wilson', fifth='roy') | |
# ('ming', 'alice', 'tom') | |
# {'fourth': 'wilson', 'fifth': 'roy'} |
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
def save_ranking(**kwargs): | |
print(kwargs) | |
save_ranking(first='ming', second='alice', fourth='wilson', third='tom', fifth='roy') | |
# {'first': 'ming', 'second': 'alice', 'fourth': 'wilson', 'third': 'tom', 'fifth': 'roy'} |
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
def save_ranking(*args): | |
print(args) | |
save_ranking('ming', 'alice', 'tom', 'wilson', 'roy') | |
# ('ming', 'alice', 'tom', 'wilson', 'roy') |
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
# config.py | |
DATABASE_CONFIG = { | |
'host': 'localhost', | |
'dbname': 'company', | |
'user': 'user', | |
'password': 'password', | |
'port': 3306 | |
} | |
# main.py |
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
# A function that shows the results of running competitions consisting of 2 to 4 runners. | |
def save_ranking(first, second, third=None, fourth=None): | |
rank = {} | |
rank[1], rank[2] = first, second | |
rank[3] = third if third is not None else 'Nobody' | |
rank[4] = fourth if fourth is not None else 'Nobody' | |
print(rank) | |
# Pass the 2 positional arguments | |
save_ranking('ming', 'alice') |
NewerOlder