Skip to content

Instantly share code, notes, and snippets.

View hameedullah's full-sized avatar
😄

Hameedullah Khan hameedullah

😄
View GitHub Profile
@bueltge
bueltge / gist:1119722
Created August 2, 2011 07:03
Debug Shortcodes
function fb_show_shortcodes( $atts, $content = NULL ) {
extract( shortcode_atts(
array('linebreak'=>''),
$atts
) );
$brackets = array();
$brackets[0] = "/\[/";
$brackets[1] = "/\]/";
@bueltge
bueltge / gist:1119715
Created August 2, 2011 06:51
Shortcode for HTML5 Video Tag in WordPress
function html5_video( $atts, $content = NULL ) {
extract( shortcode_atts( array(
"src" => '',
"width" => '',
"height" => ''
), $atts ) );
return '<video src="' . $src . '" width="' . $width . '" height="' . $height . '" controls autobuffer>';
}
add_shortcode( 'video5', 'html5_video' );
Now you can use the following shortcode in your post:
@thefuxia
thefuxia / function.extra_comment_callback.php
Created June 29, 2011 19:43
Sample Comment Walker for WordPress
<?php
/**
* Callback for wp_list_comments()
* @param object $comment
* @param array $args
* @param int $depth
* @return void
*/
function extra_comment_callback( $comment, $args, $depth )
{
@markjaquith
markjaquith / disable-plugins-when-doing-local-dev.php
Created June 24, 2011 10:24
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@franz-josef-kaiser
franz-josef-kaiser / script_deamon.php
Created June 10, 2011 15:59
WordPress Plugin to check your DataBase for injected links
<?php
/**
Plugin Name: AntiScript deamon
Plugin URI: https://github.com/franz-josef-kaiser
Description: Removes script-links to spam sites from your post content after your site got hacked. Please go to <a href="tools.php?page=script_deamon.php">Tools &rarr; Remove Hack</a>. Thank you. Proudly brought to you by <a href="http://example.com">Franz Josef Kaiser</a>.
Version: 0.1
Author: Franz Josef Kaiser
Author URI: https://github.com/franz-josef-kaiser
License: GPL2
WP-Version: Tested in 2.7.1, 2.9.2, 3.0
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by mike@mikepearce.net
# modified by aconway@[redacted] - handle diffs that introduce new files
# modified by t.broyer@ltgt.net - fixes diffs that introduce new files
# modified by m@rkj.me - fix sed syntax issue in OS X
#
# Generate an SVN-compatible diff against the tip of the tracking branch
@ghoseb
ghoseb / factorial.py
Created November 14, 2008 18:58
The evolution of a Python Programmer
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal