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 { bigint, integer, serial, smallint } from "drizzle-orm/pg-core"; | |
| import type { Field } from "payload"; | |
| import toSnakeCase from "to-snake-case"; | |
| /* | |
| * Iterates through the list of fields and prepares changes using Payload's Drizzle exposure. | |
| * The fields marked with `numberType: "smallint" | "integer" | "bigint"` in their `custom` | |
| * field will use their respective column type in the schema, so postgres can coerce them. | |
| * | |
| * fields: The fields to comb through recursively. |
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 { createServer } from "node:http"; | |
| import { parse } from "node:url"; | |
| import { initGraphClient } from "@/modules/msgraph/client"; | |
| import { rosterfyImportWorkflowId } from "@/modules/volunteer/workflows/rosterfyImportWorkflow"; | |
| import config from "@payload-config"; | |
| import next from "next"; | |
| import cron from "node-cron"; | |
| import { getPayload } from "payload"; | |
| const port = Number.parseInt(process.env.PORT || "3010"); |
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 JobStopsListenerFieldEffect from "@/modules/transport/components/JobStopsListenerField/JobStopsListenerFieldEffect"; | |
| import type { UIFieldServerComponent } from "payload"; | |
| const JobStopsListenerField: UIFieldServerComponent = async ({ payload }) => { | |
| const warehouse = | |
| ( | |
| await payload.find({ | |
| collection: "addresses", | |
| where: { | |
| type: { |
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 VOWELS = 'aeiou'; | |
| const CONSONANTS = 'bcdfghjklmnpqrstvwxyz'; | |
| const generateInitialPassword = () => { | |
| const vowel = VOWELS[Math.floor(Math.random() * VOWELS.length)] | |
| const consonant = CONSONANTS[Math.floor(Math.random() * CONSONANTS.length)] | |
| const randomNumber = Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000; | |
| return `${consonant.toLocaleUpperCase()}${vowel}${consonant}${vowel}${randomNumber}`; | |
| } |
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 { Gutter } from "payload/components/elements"; | |
| import { Form, FormSubmit, RenderFields, fieldTypes } from "payload/components/forms"; | |
| import { DefaultTemplate } from "payload/components/templates"; | |
| import { AdminViewComponent } from "payload/config"; | |
| import { useStepNav } from "payload/dist/admin/components/elements/StepNav"; | |
| import { Field } from "payload/types"; | |
| import React, { useEffect } from "react"; | |
| import { useTranslation } from "react-i18next"; | |
| const PayloadFormExample: AdminViewComponent = () => { |
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
| { | |
| name: "jobStatus", | |
| type: "select", | |
| required: true, | |
| defaultValue: "toBeAssigned", | |
| options: [ | |
| { | |
| label: "To Be Assigned", | |
| value: "toBeAssigned", | |
| }, |
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
| job "mongodb" { | |
| datacenters = ["prod-azure"] | |
| type = "service" | |
| constraint { | |
| distinct_hosts = true | |
| } | |
| update { | |
| max_parallel = 1 |
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
| require 'cgi' | |
| require 'shellwords' | |
| class ConvertToPDF | |
| PDF_OPTIONS = { | |
| page_size: 'A4' | |
| }.freeze | |
| def initialize(params = {}) | |
| if !params.key?(:from) || params[:from].nil? |
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 | |
| api_key = ('API-KEY-HERE', 'X') | |
| domain = 'DOMAIN-HERE' | |
| contact_ids = [] | |
| page = 1 | |
| while True: | |
| print("Downloading page {} of deleted contacts".format(page)) | |
| results = requests.get("https://{}.freshdesk.com/api/v2/contacts?page={}&per_page=100&state=deleted".format(domain, page), auth=api_key).json() |
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 csv | |
| import re | |
| with open("test.csv", "r+") as f: | |
| with open("testoutput.csv", "w+") as g: | |
| reader = csv.DictReader(f) | |
| writer = csv.DictWriter(g, reader.fieldnames) | |
| for row in reader: | |
| date = row["Posted"] | |
| m = re.match(r"^(\d\d)/(\d\d)(.*)$", date) |
NewerOlder