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 React from 'react'; | |
import { Modal } from '@faceless-ui/modal'; | |
import { Button } from 'payload/components'; | |
import { | |
Form, | |
FormSubmit, | |
RenderFields, | |
fieldTypes, | |
} from 'payload/components/forms'; |
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 someQuestion: CollectionConfig = { | |
slug: 'some-collection', | |
custom: { | |
cacheControl: 'public, max-age=300, stale-while-revalidate=300, stale-if-error=86400', | |
}, | |
} |
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 { CollectionConfig } from "payload/types"; | |
import { UploadsGridView } from "../../components/UploadsGridView/UploadsGridView"; | |
export const Media: CollectionConfig = { | |
slug: "media", | |
admin: { | |
components: { views: { List: UploadsGridView } } // Set the List view to use the Grid view, | |
}, | |
upload: { | |
staticURL: "/media", |
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 { User } from 'payload/dist/auth'; | |
import { Access, AccessArgs, FieldAccess } from 'payload/types'; | |
type CheckerArgs = { | |
user?: User; | |
id?: string | number; | |
}; | |
type Checker = (args: CheckerArgs) => boolean; | |
const isAdmin: Checker = ({ user }) => user?.role && user?.role === 'admin'; |
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
function compress(string, encoding) { | |
const byteArray = new TextEncoder().encode(string); | |
const cs = new CompressionStream(encoding); | |
const writer = cs.writable.getWriter(); | |
writer.write(byteArray); | |
writer.close(); | |
return new Response(cs.readable).arrayBuffer(); | |
} | |
function decompress(byteArray, encoding) { |
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
#OS-GreymonSheet | |
#For switching to Master user | |
for user in $(cat /etc/passwd | grep master | awk -F : '{print $1}'); do su $user; done | |
#For Finding application with corresponging domain name | |
grep -lr "domain.com" */conf/* | |
#For checking apache logs of every application in Cloudways |
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
#MYSQL | |
#For login to mysql | |
mysql -h hostname -u dbusername -p dbname | |
#For taking dump of mysql | |
mysqldump -h hostname -u dbusername -p dbname > dbbackup.sql | |
#For taking dump without tablespaces | |
mysqldump -h hostname -u dbusername -p dbname --no-tablespaces > dbback.sql |
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
#Wordpress Sheet | |
#For verifying Core wordpress files | |
wp core verify-checksums | |
#For restricting auto update of wordpress | |
define( 'WP_AUTO_UPDATE_CORE', false ); | |
#For increasing memory limit | |
define('WP_MEMORY_LIMIT', '256M'); |
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
<!-- | |
/* | |
* Serverless contact form handler for Cloudflare Workers. | |
* Emails are sent via Mailgun. | |
* | |
* Learn more at https://maxkostinevich.com/blog/serverless-contact-form | |
* Live demo: https://codesandbox.io/s/serverless-contact-form-example-x0neb | |
* | |
* (c) Max Kostinevich / https://maxkostinevich.com | |
*/ |
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
var gm = require('gm'); | |
// Create JPG from page 0 of the PDF | |
gm("file.pdf[0]") // The name of your pdf | |
.setFormat("jpg") | |
.resize(200) // Resize to fixed 200px width, maintaining aspect ratio | |
.quality(75) // Quality from 0 to 100 | |
.write("/tmp/cover.jpg", function(error){ | |
// Callback function executed when finished | |
if (!error) { |
NewerOlder