Skip to content

Instantly share code, notes, and snippets.

🖖

Raam Dev raamdev

🖖
Block or report user

Report or block raamdev

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
@raamdev
raamdev / flickr-random-photo.php
Created Oct 6, 2012
Load a Flickr photo set and then display a random photo from that set
View flickr-random-photo.php
<?php
/**
* Raam Dev - http://raamdev.com/
*
* This code loads a Flickr Photo Set and then picks a random photo from that set
* After configuring your settings and loading the PHP, you can display the random photo as follows:
* <a href="<?php echo $flickr_img_url_large; ?>" title="<?php echo $flickr_photo_description; ?>">
* <img title="<?php echo $flickr_photo_description; ?>" border="0" src="<?php echo $flickr_img_url; ?>" />
* </a>
*
@raamdev
raamdev / postie-functions.php
Created Mar 21, 2013
Adds support for Post Formats to the WordPress Postie plugin. You can now specify a post format in the email subject like this: "Aside :: My Aside-formatted post". My changes to postie-functions.php can be found on lines L232, L305, L402, L803, and L2421.
View postie-functions.php
<?php
/*
$Id: postie-functions.php 683869 2013-03-18 21:39:57Z WayneAllen $
*/
//to turn on debug output add the following line to wp-config.php
//define('POSTIE_DEBUG', true);
if (!function_exists('mb_str_replace')) {
View gist:7109032
<?php
/* Add a checkbox to the featured image metabox */
add_filter( 'admin_post_thumbnail_html', 'theme_featured_image_meta');
function theme_featured_image_meta( $content ) {
global $post;
// Text for checkbox
$text = __( "Don't display image on post.", 'textdomain' );
@raamdev
raamdev / gist:8550578
Last active Jan 4, 2016
WordPress Shortcode for outputting a list of recent posts. Includes many options.
View gist:8550578
<?php
if ( ! function_exists( 'independent_publisher_recent_posts_shortcode' ) ) :
/**
* Returns recent posts for given category and excludes given post formats
*
* Example usage: [independent_publisher_recent_posts count="10" category="Technology" exclude_formats="aside,gallery,link" more_text="« Full Archives"]
*/
function independent_publisher_recent_posts_shortcode( $atts /*$number_posts = '10', $category = '', $exclude_formats = array()*/ ) {
$formats_to_exclude = '';
View add_filter_example.php
<?php
add_filter( 'stcr_confirmation_email_message', 'modify_email_message', 10, 3 );
function modify_email_message( $message, $_post_ID, $email ) {
$message = $message . "Adding something to the end of my email confirmation message.";
return $message;
}
View gist:8659135
<?php
/*
Plugin Name: Subscribe to Comments Reloaded
Version: 140125
Stable tag: 140125
Requires at least: 2.9.2
Tested up to: 3.8
Plugin URI: http://wordpress.org/extend/plugins/subscribe-to-comments-reloaded/
View macports.nginx.txt
# Download & install marports http://www.macports.org/install.php
$ sudo port selfupdate
$ sudo port install nginx
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist
$ sudo port install php5 +fastcgi fcgi
$ sudo mkdir /opt/local/etc/LaunchDaemons/org.macports.php-fastcgi
$ cd /opt/local/etc/LaunchDaemons/org.macports.php-fastcgi
$ mate org.macports.php-fastcgi.plist # or vim org.macports.php-fastcgi.plist
@raamdev
raamdev / nginx-mamp-macports.txt
Last active Nov 30, 2019
These are the steps to get Nginx running alongside MAMP on a Mac.
View nginx-mamp-macports.txt
# These steps will get nginx installed on your Mac for local development and
# testing purposes, to be used alongside MAMP (which already includes Apache).
# The following steps assume that you're running MAMP and that you already
# have php-cgi in /Applications/MAMP/bin/php/php5.4.10/bin/php-cgi.
# The start-nginx and stop-nginx scripts created at the end do not
# start or stop MySQL because it is assumed that you normally run MAMP
# with Apache + MySQL turned on and that you occasionally want to switch
# your web server to Nginx for testing purposes and that you leave MySQL running.
# This process was tested successfully on OS X 10.9.
@raamdev
raamdev / get.dev.sh
Last active Nov 2, 2015
Wildcard domains for development (*.dev) made simple, now with MacPorts support. See http://dev.sh for the original script.
View get.dev.sh
#!/bin/sh
set -o errexit
set -e
# Fail fast if we're not on OS X >= 10.6.0.
if [ "$(uname -s)" != "Darwin" ]; then
echo "Sorry, DevDNS requires Mac OS X to run." >&2
exit 1
View browser-caching.conf
FileETag none
<IfModule mod_headers.c>
Header unset etag
</IfModule>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType text/plain "access plus 1 week"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
You can’t perform that action at this time.