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 luhn_algorithm(card_number): | |
| """ | |
| Validates a card number using the Luhn algorithm. | |
| Args: | |
| card_number: A string or integer representing the card number to validate. | |
| Returns: | |
| Boolean: True if the card number is valid according to the Luhn algorithm, False otherwise. | |
| """ |
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
| # HTTP Server - Redirects to HTTPS | |
| server { | |
| listen 80; | |
| listen [::]:80; | |
| server_name <subdomain>.<domain>.com; | |
| # Redirect all HTTP requests to HTTPS | |
| location / { | |
| return 301 https://$host$request_uri; | |
| } |
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 json | |
| from typing import List, Set | |
| import time | |
| from datetime import datetime | |
| def load_json_file(file_path: str) -> dict: | |
| """Load and parse a JSON file.""" | |
| with open(file_path, 'r', encoding='utf-8') as f: | |
| return json.load(f) |
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 json | |
| def load_user_data(json_data, key): | |
| """Extract usernames from the JSON data""" | |
| users = [] | |
| for item in json_data[key]: | |
| username = item["string_list_data"][0]["value"] | |
| users.append(username) | |
| return set(users) |
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 webbrowser # Import webbrowser to open links | |
| import time | |
| # GitHub username | |
| USERNAME = "" | |
| # Replace 'None' with your GitHub Personal Access Token | |
| GITHUB_TOKEN= None |
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 random | |
| # GitHub Configuration | |
| GITHUB_TOKEN = "YOUR_GITHUB" | |
| REPO_OWNER = "" | |
| REPO_NAME = "" | |
| API_URL = f"https://api.github.com/repos/{REPO_OWNER}/{REPO_NAME}" | |
| HEADERS = {"Authorization": f"token {GITHUB_TOKEN}"} |
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 { NextApiResponse } from "next"; | |
| export interface PaginationResult<T> { | |
| success: boolean; | |
| data: T[]; | |
| pagination: { | |
| page: number; | |
| limit: number; | |
| totalPages: number; | |
| totalCount: number; |
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
| export const cantons = [ | |
| {title: "Aargau", code: "AG"}, | |
| {title: "Appenzell Ausserrhoden", code: "AR"}, | |
| {title: "Appenzell Innerrhoden", code: "AI"}, | |
| {title: "Basel-Landschaft", code: "BL"}, | |
| {title: "Basel-Stadt", code: "BS"}, | |
| {title: "Bern", code: "BE"}, | |
| {title: "Fribourg", code: "FR"}, | |
| {title: "Genève", code: "GE"}, | |
| {title: "Glarus", code: "GL"}, |
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
| export const countries = [ | |
| "Afghanistan", | |
| "Åland-Inseln", | |
| "Albanien", | |
| "Algerien", | |
| "Amerikanisch-Samoa", | |
| "Andorra", | |
| "Angola", | |
| "Anguilla", | |
| "Antarktis", |
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 DateDiff from "date-diff"; | |
| export function getFormattedDateDifference(dateAdded: string) { | |
| const diff = new DateDiff(new Date(), new Date(dateAdded)) | |
| if (diff.minutes() < 60) { | |
| if (Math.round(diff.minutes()) === 1) { | |
| return `${Math.round(diff.minutes())} minute ago` | |
| } | |
| return `${Math.round(diff.minutes())} minutes ago` | |
| } | |
| if (diff.hours() < 24) { |
NewerOlder