Skip to content

Instantly share code, notes, and snippets.

View BobbyRuby's full-sized avatar

Bobby Ruby BobbyRuby

View GitHub Profile
<?php
/**
* Database emtpying and file removing class.
*
* Truncates all necessary tables in the defined database and removes
* any files uploaded by the demo user.
*
* @since 1.0.0
*
* @author Thomas Griffin
@BobbyRuby
BobbyRuby / wpcf7 shortcode enable
Created October 19, 2014 14:41
enable shortcode use inside cf7
/**
* Simple function to allow shortcodes in CF7 forms.
* @param $form
* @return string
* http://wordpress.stackexchange.com/questions/45266/how-to-use-other-shortcodes-inside-contact-form-7-forms
*/
function mycustom_wpcf7_form_elements( $form ) {
$form = do_shortcode( $form );
return $form;
}
@BobbyRuby
BobbyRuby / debugger
Created October 19, 2014 14:38
use it alot between plugin / site dev so gisted it.
function rfd_debugger($debugItem, $die = 0){
echo '<pre>';
print_r($debugItem);
echo '</pre>';
if($die == 1){
die();
}
}
/**
* @param $html
* @return string
*/
function execute_php($html){
if(strpos($html,"<"."?php")!==false){
ob_start();
eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
@BobbyRuby
BobbyRuby / screen_test.js
Created October 17, 2014 14:50
Simple quick screen test script to get screen size.
// test screen every 10 pixels
var is_screen = false;
var i = 970;
while(!is_screen){
is_screen = window.matchMedia("only screen and (max-width: "+i+"px)").matches;
console.log(is_screen);
console.log(i);
i = i+10;
}