This file contains 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 { gql, useQuery } from "@apollo/client"; | |
import { useForm } from "payload/components/forms"; | |
import { useDocumentInfo } from "payload/dist/admin/components/utilities/DocumentInfo"; | |
import { Job } from "payload/generated-types"; | |
import { useEffect } from "react"; | |
import React from "react"; | |
const WarehouseIdQuery = gql(/* GraphQL */ ` | |
query WarehouseIdQuery { | |
Addresses(where: { type: { equals: warehouse } }) { |
This file contains 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 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 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 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 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 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 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) |
This file contains 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
'use strict'; | |
// # Globbing | |
// for performance reasons we're only matching one level down: | |
// 'test/spec/{,*/}*.js' | |
// use this if you want to match all subfolders: | |
// 'test/spec/**/*.js' | |
module.exports = function (grunt) { |
This file contains 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 https://github.com/Shopify/liquid/blob/63eb1aac69a31d97e343822b973b3a51941c8ac2/performance/shopify/shop_filter.rb#L100 | |
Shopify.handleize = function (str) { | |
str = str.toLowerCase(); | |
var toReplace = ['"', "'", "\\", "(", ")", "[", "]"]; | |
// For the old browsers | |
for (var i = 0; i < toReplace.length; ++i) { | |
str = str.replace(toReplace[i], ""); | |
} |
NewerOlder