Skip to content

Instantly share code, notes, and snippets.

View ucheng's full-sized avatar
💭
😄

Yu-Cheng Wang ucheng

💭
😄
View GitHub Profile
@ericandrewlewis
ericandrewlewis / gist:95239573dc97c0e86714
Last active December 12, 2023 09:52
Setting up a WordPress site on AWS

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

@staltz
staltz / introrx.md
Last active April 20, 2024 14:15
The introduction to Reactive Programming you've been missing
<?
public function rsa_verify_sign($key, $signature, $package) {
$rsa = new Crypt_RSA();
$rsa->setHash("sha256");
$rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
$rsa->loadKey($key);
$verify = $rsa->verify(base64_decode($package), $signature);
return $verify;
}
?>
@eljamez
eljamez / functions.php
Created August 28, 2013 17:49
Woocommerce, get the product's attribute title from attribute slug
// just pass in the attribute and the attribute slug
// and the return value is the attribute's name
// example : (assuming attribute size has the option of "Extra Small" withe the slug of "extra-small")
// echo attribute_slug_to_title('attribute_pa_size', 'extra-small');
// returns
// "Extra Small"
// code reworked from woocommerce/classes/class-wc-cart.php
@woogist
woogist / gist:5975638
Last active February 8, 2018 06:24
WooCommerce - Change number of related products on product page
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Change number of related products on product page
* Set your own value for 'posts_per_page'
*
*/
function woo_related_products_limit() {
@woogist
woogist / gist:5692886
Last active January 23, 2021 17:56
Sample WooCommerce Points & Rewards 3rd Party Plugin Integration
<?php
// Add the action setting
add_filter( 'wc_points_rewards_action_settings', 'points_rewards_newsletter_action_settings' );
function points_rewards_newsletter_action_settings( $settings ) {
$settings[] = array(
'title' => __( 'Points earned for newsletter signup' ),
'desc_tip' => __( 'Enter the amount of points earned when a customer signs up for a newsletter via MailChimp.' ),
@tommcfarlin
tommcfarlin / add-custom-post-type-menu.php
Created April 25, 2013 12:38
[WordPress] Add a custom post type menu as a child of an existing custom post type menu.
<?php
// Define the 'Portfolio' post type. This is used to represent galleries
// of photos. This will be our top-level custom post type menu
$args = array(
'labels' => array(
'all_items' => 'Gallery',
'menu_name' => 'Portfolio',
'singular_name' => 'Gallery',
'edit_item' => 'Edit Gallery',
@andrik
andrik / gist:3609935
Created September 3, 2012 15:02
Capistrano recipe to Webfaction
require 'bundler/capistrano'
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :user, "<<your webfaction user>>"
set :domain, "#{user}@<<your domain>>"
set :application, "<<your application>>"
set :repository, "<< your ssh repository link >>"
set :deploy_to, "/home/#{user}/webapps/#{application}"
@MatthewEppelsheimer
MatthewEppelsheimer / state-shortcode.php
Created December 19, 2011 20:10
WP Contact Form 7 shortcode with list of United States
<?php
[select member-1-state "Alabama" "Alaska" "Arizona" "Arkansas" "California" "Colorado" "Connecticut" "Delaware" "Florida" "Georgia" "Hawaii" "Idaho" "Illinois" "Indiana" "Iowa" "Kansas" "Kentucky" "Louisiana" "Maine" "Maryland" "Massachusetts" "Michigan" "Minnesota" "Mississippi" "Missouri" "Montana" "Nebraska" "Nevada" "New Hampshire" "New Jersey" "New Mexico" "New York" "North Carolina" "North Dakota" "Ohio" "Oklahoma" "Oregon" "Pennsylvania" "Rhode Island" "South Carolina" "South Dakota" "Tennessee" "Texas" "Utah" "Vermont" "Virginia" "Washington" "West Virginia" "Wisconsin" "Wyoming" "--" "District of Columbia" "Puerto Rico" "Guam" "American Samoa" "U.S. Virgin Islands" "Northern Mariana Islands"]