Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 functools import wraps | |
| def has_all_attr(self, *attribute_names): | |
| ''' | |
| An aid function to determine the condition of "not calling", this could be a parameter of conditional on potentially | |
| ''' | |
| return all((hasattr(self, attr) and getattr(self, attr) is not None) for attr in attribute_names) | |
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
| [{"id":1,"height":180,"gender":"Male","city":"Ansongo","weight":185.65,"dateOfMeasure":"7/22/2018"}, | |
| {"id":2,"height":190,"gender":"Male","city":"Huurch","weight":182.28,"dateOfMeasure":"10/26/2018"}, | |
| {"id":3,"height":198,"gender":"Male","city":"Portelândia","weight":190.85,"dateOfMeasure":"8/19/2018"}, | |
| {"id":4,"height":189,"gender":"Female","city":"Wangchang","weight":145.82,"dateOfMeasure":"6/18/2018"}, | |
| {"id":5,"height":162,"gender":"Female","city":"Kamenka","weight":128.84,"dateOfMeasure":"2/16/2019"}, | |
| {"id":6,"height":183,"gender":"Female","city":"Ibiporã","weight":130.62,"dateOfMeasure":"1/31/2019"}, | |
| {"id":7,"height":197,"gender":"Male","city":"Jinchuan","weight":196.47,"dateOfMeasure":"1/29/2019"}, | |
| {"id":8,"height":161,"gender":"Female","city":"Algés","weight":160.29,"dateOfMeasure":"9/2/2018"}, | |
| {"id":9,"height":195,"gender":"Male","city":"Karangtalun","weight":179.32,"dateOfMeasure":"9/8/2018"}, | |
| {"id":10,"height":188,"gender":"Female","city":"Itu","weight":122.84,"dateOfMeasure":"4/13/2018"}, |
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 { observer, inject } from 'mobx-react' | |
| const compose = (...fns) => { | |
| const last = fns.slice(-1)[0] | |
| const decorators = fns.slice(0, -1) | |
| return decorators.reduceRight((v, f) => f(v), last); | |
| } | |
| export const SFComponents = compose( |
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
| function sumPixels(pixelA, pixelB) { | |
| var first = parseInt(pixelA.replace('px', '')) | |
| var second = parseInt(pixelB.replace('px', '')) | |
| return `${first+second}px` | |
| } | |
| function multiplyPixels(pixelString, factor) { | |
| var f = Math.floor(factor) | |
| var remainder = f ? factor % f : factor |
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 typing import List | |
| from collections import defaultdict | |
| def nested_set(nested_dict: defaultdict, path: List[str]) -> defaultdict: | |
| ''' | |
| A function that sets a value to a defaultdict given a path of keys. | |
| Example: | |
| d = defaultdict(dict) | |
| d = nested_set(d, ['hello', 'ciao', 3]) |
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 requests | |
| import datetime | |
| from pymongo import MongoClient | |
| def get_dad_joke(): | |
| r = requests.get('https://icanhazdadjoke.com/', | |
| headers = {'accept': 'text/plain'}) | |
| return r.text |
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
| type UnionizeArray<D extends Readonly<Array<string>>> = D[number] | |
| const dimensions = ['x', 'y'] as const | |
| const optionalDimensions = ['color', 'radius'] as const | |
| type numerical = 'x' | 'y' | 'radius' | |
| type _ = 'man' | 'opt' | |
| type __ = 'num' | 'nonum' |
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
| { | |
| "titleFontStyle": { | |
| "color": { | |
| "r": 0, | |
| "g": 0, | |
| "b": 0, | |
| "a": 1 | |
| }, | |
| "fontFamily": "Times New Roman", | |
| "fontSize": { |
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 loguru import logger | |
| from src.server import app, app_config | |
| if __name__ == '__main__': | |
| port = app_config['port'] | |
| host = app_config['host'] | |
| logger.info(f'Running on {host}:{port}') | |
| app.run(**app_config) |
OlderNewer