Skip to content

Instantly share code, notes, and snippets.

View misterhon's full-sized avatar

Alex Hon misterhon

  • New York, New York
View GitHub Profile
@misterhon
misterhon / .gitignore
Last active August 29, 2015 14:23
.gitignore for WordPress projects
*.log
.htaccess
sitemap.xml
sitemap.xml.gz
wp-config.php
wp-includes/*
wp-admin/*
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
@misterhon
misterhon / force-ssl.php
Created May 14, 2015 20:44
MU-Plugin to force SSL for a specific WordPress page
<?php
/**
* Plugin Name: SSL Redirect
* Description: Redirects a specific page to HTTPS
*/
if ( ! function_exists( 'force_https' ) ) {
function force_https() {
if ( is_page( 'some-page-slug-here' ) && !is_ssl() ) {
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 );
exit();
@misterhon
misterhon / ymapi_connect.php
Last active November 25, 2020 03:38
YourMembership API Requests in PHP
<?php
/**
* Authenticate user via the API
*
* Documentation:
* http://www.yourmembership.com/company/api-reference.aspx
*/
define( 'API_ENDPOINT', 'https://api.yourmembership.com' );
define( 'API_VERSION', '2.02' );
@misterhon
misterhon / webhook-dev.php
Last active August 29, 2015 14:16
Webhook scirpt v.1
<?php
/**
* This script pulls updates from repo and copies to the public directory
**/
$output = `cd ~/repo_dir && git pull && cp -r ~/repo_dir/* ~/public_html`;
if ( $output ) {
$to = 'your@email.com';