Skip to content

Instantly share code, notes, and snippets.

View flowdee's full-sized avatar

flowdee flowdee

View GitHub Profile
@flowdee
flowdee / paddle-revenue.js
Created September 7, 2022 08:34 — forked from trungdq88/paddle-revenue.js
A scriptable's script to get Paddle revenue from multiple accounts using puppeteer.
/*
RUN THE SCRIPT BY YOURSELF:
- Run `node paddle-revenue.js` on your server and let it run 24/7.
- Access the API at http://your_server_ip:8175/ (JSON)
HOSTED VERSION:
If you don't want to run the script by your own, you can use the
hosted version. The price is $5 per month per Paddle account.
Here is how:
@flowdee
flowdee / ajax.php
Created March 2, 2019 08:26
Admin Ajax Example
<?php
/**
* AJAX actions
*
* @since 1.0.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
@flowdee
flowdee / edd-sl.php
Created May 21, 2017 08:37
EDD License upgrade: Extend expiration
/**
* License upgrade: Extend expiration
*/
add_action('edd_sl_license_upgraded', function( $license_id, $args ) {
$license = edd_software_licensing()->get_license( $license_id );
$download_id =$license->download->id;
$download = new EDD_SL_Download( $download_id );
$download_exp_length = $download->get_expiration_length();
@flowdee
flowdee / wordpress-base-custom-data.php
Created May 11, 2017 20:44 — forked from paulund/wordpress-base-custom-data.php
A PHP class to handle CRUD functionality in WordPress default tables.
<?php
/**
* Abstract class which has helper functions to get data from the database
*/
abstract class Base_Custom_Data
{
/**
* The current table name
*
* @var boolean
@flowdee
flowdee / Blueposts (including title)
Created January 30, 2015 15:00
Blueposts for WordPress (including title)
[bluepost title="Lorem ipsum dolor sit"]
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
[/bluepost]
@flowdee
flowdee / Blueposts (including title & link)
Created January 30, 2015 14:59
Blueposts for WordPress (including title & link)
@flowdee
flowdee / Blueposts (Standard)
Created January 30, 2015 14:59
Blueposts for WordPress (Standard)
[bluepost]
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
[/bluepost]
@flowdee
flowdee / isotope-lazyload.js
Created December 28, 2014 11:24
Isotope sorting& filtering enhancements for Unveil Lazy Load: Add this three lines to refresh lazy load items and display them after sorting / filtering.
var $iso = $('.container').isotope({
itemSelector: '.item',
layoutMode: 'masonry',
});
// Refresh lazy load
$iso.isotope('on', 'layoutComplete', function () {
$(window).trigger("scroll");
});
@flowdee
flowdee / functions.php
Created March 31, 2014 12:07
Remove & hide WP Admin Access / Bar
// Remove dashboard access for normal users
if (!current_user_can('manage_options')) {
add_filter('show_admin_bar', '__return_false');
}
add_action('admin_init', function () {
if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
wp_redirect(home_url()); exit;
}
});
@flowdee
flowdee / functions.php
Last active August 29, 2015 13:57
Removes the closing bracket at the end of WordPress' oEmbed using YouTube.
<?php
function remove_youtube_parenthesis ($html, $url ) {
if ( preg_match('#https?://(www\.)?youtu#i', $url) ) {
$html = preg_replace('/\)$/', '', $html);
}
return $html;
}