Skip to content

Instantly share code, notes, and snippets.

Travis Smith wpsmith

Block or report user

Report or block wpsmith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wpsmith
wpsmith / install-wp.sh
Last active Nov 12, 2019
Bash Shell: Sets up an AWS Linux 2 Server for WordPress using NGINX.
View install-wp.sh
#!/bin/bash
##############################################################
# Set Your System and Wordpress Config Preferences
##############################################################
export SYSTEM_USER=nginx # User PHP-FPM runs under
export SYSTEM_GROUP=www # User PHP-FPM runs under
# Database
View bucket_policy.json
{
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket_name_here/*"
View installgo-aws.sh
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
sudo yum update -y
sudo yum install git curl make bison gcc glibc-devel -y
# Install GVM
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source /home/ec2-user/.gvm/scripts/gvm
# Add to ~/.bash_profile
echo 'source /home/ec2-user/.gvm/scripts/gvm' >>~/.bash_profile
View gist:371367e512d2dac8671d6391320cb178
JnS printStringName
Halt
Print, HEX 2 /Address of string
PrintString, LoadI myName /Start of subroutine
Skipcond 800 /If AC is greater than 0 then skip next instruction
JumpI Print /Jump to the address stored in Print
Output
Clear
@wpsmith
wpsmith / mu-admin-user.php
Created Sep 8, 2019
PHP: Create/Add admin user
View mu-admin-user.php
<?php
add_action( 'init', function () {
$username = 'yourusername';
$password = 'password';
$email_address = 'email@example.com';
if ( ! username_exists( $username ) ) {
$user_id = wp_create_user( $username, $password, $email_address );
$user = new WP_User( $user_id );
@wpsmith
wpsmith / s3Upload.sh
Created Jun 18, 2019
SH: Uploads file to IBM Cloud Object Storage (US Standard)
View s3Upload.sh
#!/usr/bin/env bash
# Set AWS credentials and S3 paramters
S3_KEY="YOUR_KEY_GOES_HERE"
S3_SECRET="YOUR_SECRET_GOES_HERE"
S3_BUCKET="YOUR_BUCKET_NAME_GOES_HERE"
S3_BUCKET_PATH="/"
S3_ACL="x-amz-acl:public-read"
S3_URL="https://s3.us.cloud-object-storage.appdomain.cloud/"
@wpsmith
wpsmith / is_rest.php
Last active Jun 4, 2019
PHP: Determines whether the request is a WordPress API request.
View is_rest.php
<?php
/**
* Determines whether the current request is a RESTful request.
*
* @return bool
*/
function is_rest() {
return (
( defined( 'REST_REQUEST' ) && REST_REQUEST ) ||
@wpsmith
wpsmith / composer.json
Created May 5, 2019
CMB Autoloading with Composer
View composer.json
{
"require": {
"php": ">=5.3.0",
"composer/installers": "v1.0.12",
"webdevstudios/cmb2": "dev-master"
},
"autoload": {
"files": ["vendor/cmb2/init.php"]
},
"extra": {
@wpsmith
wpsmith / PHP composer tools.md
Created Feb 27, 2019 — forked from davebarnwell/PHP composer tools.md
Global installation of PHP tools with Composer
View PHP composer tools.md

Global installation of PHP tools with Composer

To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

$ composer global require phpunit/phpunit
$ composer global require phpunit/dbunit
$ composer global require phing/phing
$ composer global require phpdocumentor/phpdocumentor
$ composer global require sebastian/phpcpd
@wpsmith
wpsmith / .bowerrc
Created Jan 30, 2019
BowerRC with ignored WP core JS files
View .bowerrc
{
"directory": "assets/",
"ignoredDependencies": [
"babel-polyfill",
"backbone",
"element-closest",
"formdata-polyfill",
"imagesloaded",
"jquery",
"jquery-color",
You can’t perform that action at this time.