Skip to content

Instantly share code, notes, and snippets.

Ashish Kumar ashfame

Block or report user

Report or block ashfame

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ashfame / Recharge_Compliant_CSV_From_SubscribePro_Export.php
Created Jul 12, 2018
Feed the export from SubscribePro to it and it will generate a CSV that's Recharge compliant
View Recharge_Compliant_CSV_From_SubscribePro_Export.php
// For reuse, just look inside get_mapped_value() that's where all the specific data handling is, which is what you will need to change
// To understand, how this works, head to run()
// ini_set( 'memory_limit', '2000M' );
class Recharge_Compliant_CSV_From_SubscribePro_Export {
private $source_csv_filename;
ashfame / paceOptions.js
Created Mar 9, 2018
Making Pace show for all ajax requests
View paceOptions.js
// define options for Pace - ajax progress showing library
paceOptions = {
restartOnRequestAfter: 50, // make it work for short AJAX requests only (ajax requests taking longer than 50ms will trigger it)
ajax: {
trackMethods: [ 'GET', 'POST', 'DELETE', 'PUT', 'PATCH' ]
ashfame /
Last active Feb 25, 2018
Bash script to deploy lambdas to all regions using Up -
#!/usr/bin/env bash
declare -a regions=(
us-east-2 #US East (Ohio)
us-east-1 #US East (N. Virginia)
us-west-1 #US West (N. California)
us-west-2 #US West (Oregon)
ap-northeast-1 #Asia Pacific (Tokyo)
ap-northeast-2 #Asia Pacific (Seoul)
ap-south-1 #Asia Pacific (Mumbai)
ashfame / nginx.conf
Last active Jan 9, 2018
HTTPS Cop recommended Nginx SSL config -
View nginx.conf
# To be safe, make a backup of your existing ssl config file, before making any changes in it
# Test your SSL config by "nginx -t". You might need to use "sudo nginx -t".
# Once config is validated to be good, reload nginx by "sudo service nginx reload".
# Following config file was tested on nginx/1.10.3
server {
listen 443 ssl;
View embed-code.html
<!--Begin CTCT Sign-Up Form-->
<!-- EFD 1.0.0 [Mon Aug 28 11:09:22 EDT 2017] -->
<div class="ctct-embed-signup">
<span id="success_message" style="display:none;">
<div style="text-align:center;">
<h3 class="article--title">
Thank you for taking the next step in healing your arthritis. You should receive your video in your email shortly.
# This script configures WordPress file permissions based on recommendations
# from
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
ashfame / randomize_preferred_nodes_each_node.php
Created May 3, 2015
Simple algorithm for picking up 3-7 preferred nodes for each node among a pool of nodes, so that its a little uneven (every node has different number of preferred nodes) but overall there is a balance in distribution.
View randomize_preferred_nodes_each_node.php
$nodes = array();
for ( $i = 1; $i <= 100; $i++ ) {
$nodes[ $i ] = '';
print_r( $nodes );
foreach ( $nodes as $key => &$node ) {
$random_keys_selection = array_rand( $nodes, mt_rand( 3, 7 ) );
var_dump( $random_keys_selection );
ashfame / override-wp-cli-command.php
Last active Aug 29, 2015
Example of how to override a WP-CLI command
View override-wp-cli-command.php
if ( defined('WP_CLI') && WP_CLI ) {
class Transient_Mod_Command extends Transient_Command {
public function delete_all() {
// new definition of delete-all subcommand
ashfame / plugin.php
Created Jan 20, 2015
Initial pass at a plugin which reduces the extra number of queries triggered by plugins to look for non-existent options in options table. Use this as a starting point for what you are trying to do.
View plugin.php
* Plugin Name: AnattaDesign Site Optimizer
* Plugin URI:
* Description: This plugin optimizes the site by reducing the extra number of queries triggered by plugins to look for non-existent options in options table
* Version: 0.1
* Author: Anatta Design
* Author URI:
View filtering-expiration-transient-wordpress.php
add_action( 'set_transient_my_transient', function( $value, $expiration ) {
$desired_expiration = 600;
if ( $expiration != $desired_expiration ) {
set_transient( 'my_transient', $value, $desired_expiration );
You can’t perform that action at this time.