Skip to content

Instantly share code, notes, and snippets.

View PhouvanhKCSV's full-sized avatar
🌴
On vacation

Phouvanh KCSV PhouvanhKCSV

🌴
On vacation
View GitHub Profile
@PhouvanhKCSV
PhouvanhKCSV / soulaxay-inventory.skema
Last active March 28, 2016 18:11
the description for this gist
[{"name":"userId","color":"Blue","position":{"x":80,"y":83},"increment":true,"timestamp":true,"softdelete":false,"column":[{"name":"id","type":"increments","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c30","order":0},{"name":"firstName","type":"string","length":"50","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":true,"un":false,"fillable":true,"guarded":false,"visible":true,"hidden":false,"colid":"c38","order":1}],"relation":[],"seeding":[]}]
@PhouvanhKCSV
PhouvanhKCSV / active-woocommerce-subscription.php
Created April 11, 2017 09:44 — forked from UltimateWoo/active-woocommerce-subscription.php
Check if the current user has an active WooCommerce subscription
<?php
/**
* Check if the current user has an active subscription.
* Redirect the user if no active subscription and the current post is a singule forum.
* This code should not be copied and pasted as is. It is only to demonstrate the wcs_user_has_subscription() function.
*
* wcs_user_has_subscription( $user_id = 0, $product_id = '', $status = 'any' )
* @param int (optional) The ID of a user in the store. If left empty, the current user's ID will be used.
* @param int (optional) The ID of a product in the store. If left empty, the function will see if the user has any subscription.
function tattoo_submit() {
if (isset($_POST["addtattoo"])) {
$title = "Tattoo : ". $_POST["tatooInput"];
$my_post = array(
'post_title' => $title,
'post_status' => 'publish',
'post_author' => 1,
@PhouvanhKCSV
PhouvanhKCSV / switch-subscription-link.php
Created July 4, 2017 06:59 — forked from thenbrent/switch-subscription-link.php
Output a link to switch a subscription for the current user.
@PhouvanhKCSV
PhouvanhKCSV / gist:6496481fd274199a4c809ed2e1a4ac73
Created July 4, 2017 07:03 — forked from WillBrubaker/gist:0e66c7a53cfcfecb16bd
Change WooCommerce Subscriptions "Change Payment Method" text
add_filter( 'woocommerce_change_payment_button_text', 'wooninja_change_payment_button_text' );
function wooninja_change_payment_button_text() {
return 'MY BUTTON TEXT';
}
add_filter( 'woocommerce_my_account_my_subscriptions_actions', 'wooninja_filter_subscriptions_actions', 99 );
function wooninja_filter_subscriptions_actions( $actions ) {
foreach ( $actions as $key => $value ) {
@PhouvanhKCSV
PhouvanhKCSV / array_multi_unique.php
Created July 21, 2017 07:57 — forked from twysto/array_multi_unique.php
[PHP] array_unique in a multi-dimensional array
<?php
function array_multi_unique($array) {
$tmp_ComparisonArray = $final_Array = Array();
foreach($array as $key => $value) {
if(!in_array($value[0], $tmp_ComparisonArray)) {
$tmp_ComparisonArray[] = $value[0];

MAMP PRO 4 Trial Reset

A simple script that resets latest MAMP PRO 4 trial validity, and keeps your data safe.

How to use

  • Copy the code into a file OR download the script and save it as reset_mamp4.sh
  • Open the Terminal app and write chmod +x then drag and drop the file on the Terminal. You should have something like chmod +x reset_mamp4.sh. Press Enter to run it.
  • Now, run the file itself by dragging and dropping it on the Terminal (something like reset_mamp4.sh) then pressing Enter.
  • Open MAMP PRO and check if you have 14 days left now.

Didn't work?

# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
@PhouvanhKCSV
PhouvanhKCSV / deprecated.md
Created August 15, 2017 04:28 — forked from Rarst/deprecated.md
WordPress coding standards configuration for PhpStorm

Now Native

PhpStorm now bundles WordPress coding style natively, starting from version 8.

  1. Go to Project Settings > Code Style > PHP.
  2. Select Set From... (top right of window) > Predefined Style > WordPress.

No longer need to muck with this import! :)

@PhouvanhKCSV
PhouvanhKCSV / php-oracle.md
Created September 6, 2017 08:48 — forked from odan/php-oracle.md
XAMPP - Oracle Driver Setup (v12)