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
| class County: | |
| def __init__(self, state_code: str, county_name: str): | |
| self.state_code = state_code | |
| self.county_name = county_name | |
| counties = [ | |
| County("AL","Autauga"), | |
| County("AL","Baldwin"), | |
| County("AL","Barbour"), |
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 random | |
| # List of available cards and values | |
| cards = { | |
| "2": 2, | |
| "3": 3, | |
| "4": 4, | |
| "5": 5, | |
| "6": 6, | |
| "7": 7, |
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 interface EmailAttachment { | |
| filename: string; | |
| mimeType: string; | |
| disposition: string; | |
| related: boolean; | |
| contentId: string; | |
| content: unknown; | |
| } | |
| export interface EmailAddress { |
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
| const PostalMime = require('postal-mime'); | |
| export interface EmailMessage { | |
| readonly from: string; | |
| readonly to: string; | |
| readonly headers: Headers; | |
| readonly raw: ReadableStream; | |
| readonly rawSize: number; | |
| setReject(reason: String): void; | |
| forward(rcptTo: string, headers?: Headers): Promise<void>; |
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
| const DAY_SECONDS = 86400; | |
| const WEEK_SECONDS = 604800; | |
| const YEAR_SECONDS = WEEK_SECONDS * 52; | |
| export function timeAgo(date: Date) { | |
| const epoch = Math.round(date.getTime() / 1000); | |
| const now = Math.round(Date.now() / 1000); | |
| const seconds = now - epoch; | |
| const minutes = Math.round(seconds / 60); | |
| const hours = Math.round(seconds / 3600); |
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
| const values = ['foo', 'bar'] as const; | |
| type MyValues = typeof values[number]; | |
| function isOneOfMyValues(elem: unknown): elem is MyValues { | |
| const opts: string[] = [...values]; | |
| return opts.includes(String(elem)); | |
| } | |
| function lengthOfMyThing(x: MyValues | null) { | |
| if (isOneOfMyValues(x)) { |
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 COLOR_NAMES = [ | |
| 'aliceblue', | |
| 'antiquewhite', | |
| 'aqua', | |
| 'aquamarine', | |
| 'azure', | |
| 'beige', | |
| 'bisque', | |
| 'black', | |
| 'blanchedalmond', |
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
| // Credit:: https://github.com/cloudfour/simple-svg-placeholder | |
| type SvgOptions = { | |
| width: number | |
| height: number | |
| text: string | |
| fontFamily: string | |
| fontWeight: string | |
| bgColor: string | |
| textColor: string |
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 { IncomingRequest } from '../incoming-request' | |
| const buckets: { [key: string]: string } = { | |
| 'bucket-name': 'https://bucket-url/', | |
| } | |
| interface RequestInitWithCf extends RequestInit { | |
| cf: RequestInitCfProperties & { | |
| image: BasicImageTransformations & { | |
| quality?: number | undefined |
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 function helloWorld(): Response { | |
| return new Response('Hello World', { | |
| status: 200, | |
| }) | |
| } |
NewerOlder