For simple decorators, use Callable
:
from typing import Callable, Any
from functools import wraps
def my_decorator(func: Callable[..., Any]) -> Callable[..., Any]:
@wraps(func)
{ | |
// ===== Editor & Workbench Settings ===== | |
"workbench.settings.editor": "json", | |
"extensions.ignoreRecommendations": true, | |
"editor.defaultFormatter": "esbenp.prettier-vscode", | |
"editor.formatOnSave": true, | |
"editor.minimap.enabled": false, | |
"editor.tabSize": 4, | |
// ===== Look & Feel ===== |
.DEFAULT_GOAL := help | |
.PHONY: help | |
help: | |
@echo "Welcome to $(NAME)!" | |
@echo "Use 'make <target>' where <target> is one of:" | |
@echo "" | |
@echo " all run build -> stop -> run" | |
@echo " build build docker image based on shell ENV_VAR" | |
@echo " stop stop docker container" | |
@echo " run run docker container" |
name: Generate CSV | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "30 23 * * *" # https://crontab.guru/#30_23_*_*_* | |
env: | |
PGDATABASE: ${{ secrets.PGDATABASE }} | |
PGHOST: ${{ secrets.PGHOST }} | |
PGPASSWORD: ${{ secrets.PGPASSWORD }} | |
PGPORT: ${{ secrets.PGPORT }} |
image: renovate/renovate:32.6.12 | |
variables: | |
LOG_LEVEL: debug | |
renovate:on-schedule: | |
tags: | |
- your-gitlab-runner-tag-if-any | |
only: | |
- schedules |
// ... | |
app.collector.OnXML(restaurantXPath, func(e *colly.XMLElement) { | |
url := e.Request.AbsoluteURL(e.ChildAttr(restaurantDetailUrlXPath, "href")) | |
location := e.ChildText(restaurantLocationXPath) | |
longitude := e.ChildAttr(restaurantXPath, "data-lng") | |
latitude := e.ChildAttr(restaurantXPath, "data-lat") | |
e.Request.Ctx.Put("location", location) |
// /server/src/datasources/paste.js | |
const { ApolloError } = require('apollo-server-cloudflare') | |
const moment = require('moment') | |
/* | |
Create a new paste in `PASTE_DB`. | |
Fetch a new `uuid` key from `KEY_DB`. | |
UUID is then removed from `KEY_DB` to avoid duplicates. |
// handlers/createShortUrl.js | |
import { generateUniqueUrlKey } from '../utils/urlKey' | |
export const createShortUrl = async (request, event) => { | |
try { | |
const urlKey = await generateUniqueUrlKey() | |
const { host } = new URL(request.url) | |
const shortUrl = `https://${host}/${urlKey}` |
const TODOIST_API_ENDPOINT = 'https://api.todoist.com/rest/v1' | |
// Passing in the `question` object from fetchDailyCodingChallenge function | |
const createTodoistTask = async question => { | |
const questionInfo = question.data.activeDailyCodingChallengeQuestion | |
const questionTitle = questionInfo.question.title | |
const questionDifficulty = questionInfo.question.difficulty | |
const questionLink = `https://leetcode.com${questionInfo.link}` |
def add_book(book_id, storage=[]): | |
storage.append(book_id) | |
return storage | |
my_book_list = add_book(1) | |
print(my_book_list) | |
my_other_book_list = add_book(2) | |
print(my_other_book_list) |