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
@iridakos
iridakos / google-analytics-realtime-counter-update.js
Last active Feb 12, 2018
Show Google Analytics active users counter in document title and a notification whenever it changes.
View google-analytics-realtime-counter-update.js
/*
This script will display the Google Analytics active users count on
the tab's title and in a notification whenever it changes.
Usage: Open your browser's console when in a Google Analytics Realtime
tab and paste the following.
Reload the tab to discard this functionality.
*/
View gist:4fa3c4228a8bb53cc71d
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@lemiorhan
lemiorhan / post-receive
Last active Jun 8, 2019
Post-receive hook to deploy the code being pushed to production branch to a specific folder
View post-receive
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@Vinai
Vinai / fix-url-keys.php
Last active Mar 12, 2019
This fixes the duplicate url_key issue in a Magento 1.8 / 1.13 installation.
View fix-url-keys.php
<?php
/**
* Drop this into the shell directory in the Magento root and run with -h to see all options.
*/
require_once 'abstract.php';
/**
* Fix duplicate url keys for categories and products to work with the 1.8 alpha1 CE url key constraints.
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ashfame
ashfame / generate-thumbnails.php
Created Aug 5, 2012 — forked from Viper007Bond/generate-thumbnails.php
WordPress: When a thumbnail image is requested of a specific width/height (rather than by name), generate it if it doesn't exist.
View generate-thumbnails.php
<?php /*
**************************************************************************
Plugin Name: Generate Thumbnails On The Fly
Description: When a thumbnail image is requested of a specific width/height (rather than by name), generate it if it doesn't exist.
Version: 1.0.0
Author: Alex Mills (Viper007Bond)
Author URI: http://www.viper007bond.com/
@Viper007Bond
Viper007Bond / generate-thumbnails.php
Created May 25, 2012
WordPress: When a thumbnail image is requested of a specific width/height (rather than by name), generate it if it doesn't exist.
View generate-thumbnails.php
<?php /*
**************************************************************************
Plugin Name: Generate Thumbnails On The Fly
Description: When a thumbnail image is requested of a specific width/height (rather than by name), generate it if it doesn't exist.
Version: 1.0.0
Author: Alex Mills (Viper007Bond)
Author URI: http://www.viper007bond.com/
@colinmollenhour
colinmollenhour / cleanCache.php
Created May 17, 2012
Simplified cache cleaning script for production updates.
View cleanCache.php
<?php
/**
* Set global/skip_process_modules_updates to '1' in app/etc/local.xml and
* then use this script to apply updates and refresh the config cache without
* causing a stampede on the config cache.
*
* @author Colin Mollenhour
*/
umask(0);
ini_set('memory_limit','512M');
View My Magento Code.php
<block type="cms/block" name="block_name">
<action method="setBlockId"><id>block_code</id></action>
</block>
{{block type="cms/block" block_id="block_code"}}
{{block type="catalog/product_list" category_id="79" template="catalog/product/list_random.phtml"}}
View wp-query-ref.php
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
You can’t perform that action at this time.