Skip to content

Instantly share code, notes, and snippets.

View ActuallyConnor's full-sized avatar
:octocat:
Reading

Connor Smyth ActuallyConnor

:octocat:
Reading
View GitHub Profile

sails-js-hook-dotenv

By Connor Smyth

Introduction

I created the sails-js-hook-dotenv package to solve a problem I was facing in my development with Sails.js. That problem was the ability to load environment variables (whether through a .env file or system stored variables), which is a staple feature of building 12-factor apps. Understandably, Sails.js does not have this feature yet since it is still

<script>
</script>
@ActuallyConnor
ActuallyConnor / slackChallengeHandler.php
Last active January 20, 2021 19:05
Slack Events API challenge handler - Laravel Controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class BurritoController extends Controller {
public function slackChallenge( Request $request ) {
if ( !empty( $request->json() ) ) {
@ActuallyConnor
ActuallyConnor / sftp_phpseclib.php
Created January 20, 2021 18:16
SFTP with PHP Sec Lib
<?php
// composer require phpseclib
include get_stylesheet_directory() . "/vendor/autoload.php";
use phpseclib\Net\SFTP;
function sftp() {
$sftp = new SFTP( SFTP_HOST ); // Stored in wp-config.php (also 1Password)
if ( !$sftp->login( SFTP_USER, SFTP_PW ) ) { // Stored in wp-config.php (also 1Password)
throw new Exception( 'Login failed' );
@ActuallyConnor
ActuallyConnor / cpt_url_rewrite.php
Last active January 20, 2021 16:30
WP URL rewrite to follow structure of example.com/{post_type}/{taxonomy_term}/{post_name}
<?php
/**
* This assumes you've created a CPT and a custom taxonomy that functions like a tag.
* You simply attach the taxonomy term to a specific post and voila.
* Refresh your permalinks!
* My recommendation would be to use ACF to only allow one tag to be set per post.
*/
/**
* Filter the custom post type link to create prettier URLs that follow the structure:
<iframe src="<?php echo $url; ?>" width='100%' height='100%' allowfullscreen webkitallowfullscreen></iframe>