Skip to content

Instantly share code, notes, and snippets.

View renatonascalves's full-sized avatar
🇧🇷

Renato Alves renatonascalves

🇧🇷
View GitHub Profile
@myshov
myshov / function_invocation.js
Last active January 21, 2024 15:14
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@slaFFik
slaFFik / ab-bp-retroactiveusers.php
Last active November 16, 2021 22:52 — forked from technosailor/ab-bp-retroactiveusers.php
Populate WordPress User Meta so that even users who have never logged in will display on the Members BP page
<?php
/*
Plugin Name: Retroactive BP User Acticity
Plugin URI: https://gist.github.com/3953927
Description: Makes all BuddyPress users visible immediately on user creation and retroactively adjust users to allow for their display before logging in.
Author: Aaron Brazell
Version: 1.0
Author URI: http://technosailor.com
License: MIT
License URI: http://opensource.org/licenses/MIT
@mikejolley
mikejolley / functions.php
Created February 10, 2017 14:49
WooCommerce - Notify admin when a new customer account is created
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_action( 'woocommerce_created_customer', 'woocommerce_created_customer_admin_notification' );
function woocommerce_created_customer_admin_notification( $customer_id ) {
wp_send_new_user_notifications( $customer_id, 'admin' );
}
1. Highlight a recommended option,

2. Allow users to switch currency (€/$/£)

3. Allow users to switch pricing monthly/yearly

4. Keep the entire pricing plan area clickable

5. Use slider to calculate how much a user would save

6. Provide free first month for good engagement

7. Prominently highlight testimonials prominently

8. Repeating call to action on top and bottom

9. Sell benefits instead of features

10. Indicate that users can cancel any time

@bjornjohansen
bjornjohansen / test-password-permutations.php
Last active February 2, 2017 11:09
Test a bunch of permutations of the password when logging into WordPress.
<?php
/**
* Test a bunch of permutations of the password when logging into WordPress.
*
* Drop this file in your mu-plugins directory.
* Inspired by Facebook: https://twitter.com/gcpascutto/status/821755332984717314/photo/1
* Works with any properly coded hashing pluggables, like Roots’ WP Password bcrypt.
*
* @author bjornjohansen
* @version 0.1.4
@bjornjohansen
bjornjohansen / moderate_comments.sh
Created October 2, 2016 12:12
Moderate comments in a WordPress installation with WP-CLI
#!/bin/bash
# Copyright © 2016 Bjørn Johansen
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
# Check if WP-CLI is available
if ! hash wp 2>/dev/null; then
echo "WP-CLI is not available"
exit
@bekarice
bekarice / wc-hide-non-free-shipping.php
Created September 22, 2016 04:11
Show only free / $0 shipping methods when available
<?php // only copy if needed
/**
* Hides any non-free shipping methods if free shipping is available
*
* @param array $rates array of \WC_Shipping_Rate objects that apply to the cart
* @return array - the updated available rates
*/
function sww_wc_hide_non_free_shipping( $rates ) {
@khromov
khromov / deploy.php
Created June 8, 2016 07:28
Deploy WordPress with Deployer on EasyEngine
<?php
require 'recipe/common.php';
// Set configurations
set('repository', 'ssh://gogs@git.server.com:22/user/repo.git');
set('shared_files', ['public/wp-config.php']);
set('shared_dirs', ['public/wp-content/uploads']);
set('writable_dirs', []);
set('keep_releases', 10);
set('composer_command', 'composer');
@lucnap
lucnap / fb-page-access-token-no-expire
Last active October 22, 2021 09:53
How to get a Facebook Page Access Token that doesn't expire Never!
How to get a Facebook Page Access Token that doesn't expire Never!
- Go to http://developers.facebook.com/tools/explorer/
- Get a User Access Token with a permission "manage_pages"
- Convert this short-lived access token into a long-lived one by making this Graph API call:
https://graph.facebook.com/v2.6/oauth/access_token?client_id=<your FB App ID >&client_secret=<your FB App secret>&grant_type=fb_exchange_token&fb_exchange_token=<your short-lived access token>
- Make a call Graph API:
https://graph.facebook.com/v2.6/<your personal account FB user id>/accounts?access_token=<your long-lived access token>
- The returned access_token has no expiration unless you change your password or not more admin of the target page or deauthorize FB page
@johnbillion
johnbillion / wp_mail.md
Last active January 27, 2024 14:06
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail