Skip to content

Instantly share code, notes, and snippets.

💭
Building AirGapped Crypto Vault

Ashish Kumar ashfame

💭
Building AirGapped Crypto Vault
View GitHub Profile
@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 / 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 / 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 / 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>
View useful-shell-commands.sh
# Set 644 permission on all PHP files recursively
find . -type f -name '*.php' -exec chmod 644 '{}' \+
@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() {
@ashfame
ashfame / local-config-awesome-wp-config-file.php
Created Feb 27, 2012
Local config file to hold db credentials and for defining keys & salts along with the use of awesome wp-config.php file
View local-config-awesome-wp-config-file.php
<?php
/**
* WordPress config file to use one directory above WordPress root, when awesome version of wp-config.php is in use.
*
* Awesome wp-config.php file - https://gist.github.com/1923821
*/
/* WordPress Local Environment DB credentials */
View awesome-wp-config-file.php
<?php
/**
* Define type of server
*
* Depending on the type other stuff can be configured
* Note: Define them all, don't skip one if other is already defined
*/
define( 'DB_CREDENTIALS_PATH', dirname( ABSPATH ) ); // cache it for multiple use
@ashfame
ashfame / Best-way-to-wrap-up-your-jQuery-code-for-avoiding-conflicts.js
Created Feb 27, 2012
Best way to wrap up your jQuery code for avoiding conflicts
View Best-way-to-wrap-up-your-jQuery-code-for-avoiding-conflicts.js
(function($){
// Regular jQuery code inside
$(document).ready(function(){
});
})(jQuery);
View svn-commands.sh
# Count no of files in repo
svn info -R --xml file:///path/to/rep | grep kind=\"file\"|wc -l
# SVN command to give commit authors list and save it in author-transform.txt
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
You can’t perform that action at this time.