Skip to content

Instantly share code, notes, and snippets.

@marco-s
marco-s / generate_update.sh
Created November 21, 2011 22:41 — forked from xentek/generate_update.sh
Generate the necessary sql statements to move a WordPress site from one environment to another
#!/usr/bin/env bash
echo "@@@ @@@ @@@@@@@@ @@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@@ @@@ @@@@@@@@ @@@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@! !@@ @@! @@!@!@@@ @@! @@! @@! !@@ "
echo "!@! @!! !@! !@!!@!@! !@! !@! !@! @!! "
echo " !@@!@! @!!!:! @!@ !!@! @!! @!!!:! @!@@!@! "
echo " @!!! !!!!!: !@! !!! !!! !!!!!: !!@!!! "
echo " !: :!! !!: !!: !!! !!: !!: !!: :!! "
echo ":!: !:! :!: :!: !:! :!: :!: :!: !:! "
@marco-s
marco-s / generate_update.sh
Created February 13, 2012 22:45 — forked from scribu/generate_update.sh
Generate the necessary sql statements to move a WordPress site from one environment to another
#!/usr/bin/env bash
echo "@@@ @@@ @@@@@@@@ @@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@@ @@@ @@@@@@@@ @@@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@! !@@ @@! @@!@!@@@ @@! @@! @@! !@@ "
echo "!@! @!! !@! !@!!@!@! !@! !@! !@! @!! "
echo " !@@!@! @!!!:! @!@ !!@! @!! @!!!:! @!@@!@! "
echo " @!!! !!!!!: !@! !!! !!! !!!!!: !!@!!! "
echo " !: :!! !!: !!: !!! !!: !!: !!: :!! "
echo ":!: !:! :!: :!: !:! :!: :!: :!: !:! "
@marco-s
marco-s / test-list-tables.php
Created February 13, 2012 22:47 — forked from scribu/test-list-tables.php
WP Admin List Tables hooks
<?php
//////////////////
// Screens
//////////////////
// Posts
foreach ( array(
'posts', 'pages', 'recipe_posts',
'edit-post', 'edit-page', 'edit-recipe',
@marco-s
marco-s / install-phpunit.sh
Created February 13, 2012 22:47 — forked from scribu/install-phpunit.sh
PHPUnit install script on Ubuntu
#!/bin/bash
sudo apt-get install php-pear
sudo pear upgrade pear
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com
@marco-s
marco-s / image-shortcode.php
Created March 13, 2012 18:29 — forked from kovshenin/image-shortcode.php
Image shortcode for WordPress
<?php
/**
* Image shortcode callback
*
* Enables the [kovshenin_image] shortcode, pseudo-TimThumb but creates resized and cropped image files
* from existing media library entries. Usage:
* [kovshenin_image src="http://example.org/wp-content/uploads/2012/03/image.png" width="100" height="100"]
*
* @uses image_make_intermediate_size
*/
@marco-s
marco-s / gist:2151785
Created March 21, 2012 19:33 — forked from jdevalk/gist:1347575
Function to move searches for non-post post-types / taxonomies to their respective archives.
<?php
function yoast_change_template( $template ) {
global $wp_query;
if ( !isset($wp_query->query_vars['taxonomy']) )
return $template;
$taxonomy = get_taxonomy( $wp_query->query_vars['taxonomy'] );
if ( is_search() && count( $taxonomy->object_type ) > 0 && !in_array( 'post', array_values($taxonomy->object_type) ) ) {
set_query_var('post_type', $taxonomy->object_type[0]);
$newtemplate = get_archive_template();
@marco-s
marco-s / wordstream-api-class.php
Created March 21, 2012 19:35 — forked from jdevalk/wordstream-api-class.php
WordStream API interface class for WordPress
<?php
/**
* Class containing all the functionality to get data from the WordStream API
*
* @link http://api.wordstream.com/doc/introduction
*
* @author Joost de Valk <joost@yoast.com>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@marco-s
marco-s / gist:2151809
Created March 21, 2012 19:35 — forked from jdevalk/gist:1565059
oembed function to use content_width appropriately
<?php
function yoast_oembed_dataparse( $html, $data, $url ) {
global $content_width;
preg_match( '/width="(\d+)"/', $html, $matches );
$width = $matches[1];
preg_match( '/height="(\d+)"/', $html, $matches );
$height = $matches[1];
$aspect_ratio = $width / $height;
@marco-s
marco-s / gist:2151833
Created March 21, 2012 19:37 — forked from jdevalk/gist:1918689
Turn a spiderable list of links into a dropdown + a go button with jQuery
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
// Inspiration partly from: http://stackoverflow.com/questions/1897129
jQuery(document).ready(function($) {
$('ul.dropdown').each(function(){
var list = $(this);
var select = $(document.createElement('select'))
.attr('id',$(this).attr('id'))
# custom login link
RewriteRule ^login$ http://localhost/whitelabel/wp-login.php [NC,L]