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
ashfame / Correct-way-to-enqueue-scripts-and-style-in-WordPress.php
Created Feb 27, 2012
Correct way to enqueue scripts and style in WordPress
View Correct-way-to-enqueue-scripts-and-style-in-WordPress.php
<?php
/**
* Register Styles and Scripts
*/
add_action( 'wp_enqueue_scripts', 'ft_scripts_styles' );
function ft_scripts_styles() {
View useful-shell-commands.sh
# Set 644 permission on all PHP files recursively
find . -type f -name '*.php' -exec chmod 644 '{}' \+
@ashfame
ashfame / config.xml
Created May 4, 2012
Overriding admin template in magento
View config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Anattadesign_Adminoverrider>
<version>1.0.0</version>
</Anattadesign_Adminoverrider>
</modules>
<global>
<layout>
<adminhtml_sales_order_create_index>
@ashfame
ashfame / functions.php
Created Aug 3, 2012
Add page slug to body class
View functions.php
<?php
function custom_body_class($classes){
global $wp_query;
if ( is_page() ) {
$post_obj = $wp_query->get_queried_object();
array_push($classes, 'slug-'.$post_obj->post_name);
}
return $classes;
@ashfame
ashfame / modify-page-title.php
Created Aug 3, 2012
Modifying page title using the_title filter in WordPress
View modify-page-title.php
<?php
add_filter( 'the_title', 'nine11day_modify_post_title' );
function nine11day_modify_post_title( $title ) {
if ( is_page() && in_the_loop() && $title == 'Existing Title' )
$title = '<span>Existing</span> Title';
return $title;
}
@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/
@ashfame
ashfame / driver.js
Created Aug 7, 2012
kissmetrics-property-device
View driver.js
(function(){
var isFirstVisit = false;
if ( document.referrer == '' ) {
isFirstVisit = true;
} else {
// If referrer is not the site itself
if ( ! ( document.referrer.match( window.location.host ) ) )
isFirstVisit = true;
}
if ( isFirstVisit ) {
@ashfame
ashfame / .gitignore
Created Dec 5, 2012
Magento repo sample .gitignore
View .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@ashfame
ashfame / ios-test.css
Created Dec 9, 2012 — forked from tonywok/ios-test.css
iOS Media Queries
View ios-test.css
// iOS Media Queries
// Goal: capture styles for iPhone, iPhone 3G, iPhone 3GS, iPhone 4, iPhone 4S, iPad, and iPad 2
//
// Author: Tony Schneider (@tonywok)
// Please tell me where I fail. :)
// iPhone v(4,4S) portrait
// test: black text (overwritten by v* portrait) with blue background
@media all and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {
a {
@ashfame
ashfame / magento-set-defaults-address.php
Created Jun 13, 2013
Programmatically set default billing/shipping address of customers if they are not set in magento
View magento-set-defaults-address.php
<?php
require_once ("app/Mage.php");
umask(0);
Mage::app("default");
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*');
foreach ($collection as $customer) {
You can’t perform that action at this time.