Skip to content

Instantly share code, notes, and snippets.

View sirbrillig's full-sized avatar

Payton Swick sirbrillig

View GitHub Profile
@sirbrillig
sirbrillig / phpcs.xml
Last active May 19, 2021 14:17 — forked from Ovsyanka/ruleset.xml
PHPCS rules for PSR2 with tabs, same-line braces, and missing variable detection
<?xml version="1.0"?>
<ruleset name="PaytonsStandard">
<description>
Originally from https://gist.github.com/Ovsyanka/e2ab2ff76e7c0d7e75a1e4213a03ff95
PSR2 with changes:
- tabs instead of spaces (https://gist.github.com/gsherwood/9d22f634c57f990a7c64)
- bracers on end of line instead new line
- unused/undefined variable detection (https://github.com/sirbrillig/phpcs-variable-analysis)
</description>
<arg name="tab-width" value="4"/>
@sirbrillig
sirbrillig / functions.php
Last active January 24, 2024 15:46 — forked from UmeshSingla/functions.php
Post file using wp_remote_post in WordPress
<?php
$local_file = 'file_path'; //path to a local file on your server
$post_fields = array(
'name' => 'value',
);
$boundary = wp_generate_password( 24 );
$headers = array(
'content-type' => 'multipart/form-data; boundary=' . $boundary,
);
@sirbrillig
sirbrillig / pgsql_backup.sh
Last active May 8, 2024 00:20 — forked from dangerousbeans/pgsql_backup.sh
Postgresql daily backup script.
#!/bin/bash
#
# Backup a Postgresql database into a daily file.
#
BACKUP_DIR=/pg_backup
DAYS_TO_KEEP=14
FILE_SUFFIX=_pg_backup.sql
DATABASE=
USER=postgres