Skip to content

Instantly share code, notes, and snippets.

View szbl's full-sized avatar

Sizeable, Inc. szbl

View GitHub Profile
<!doctype html>
<html>
<head>
<title>Testing</title>
<style type="text/css">
/* Begin Photoshop Copy/Paste */
.Rounded_Rectangle_1 {
border-style: solid;
border-width: 1px;
<div class="vfd-donor-ticker">
<div class="vfd-donor-ticker-wrap">
<ul>
<li>
<span class="name">
Elvis Presley
</span>
<span class="amount red-text">
$200
</span>
<?php
add_shortcode( 'format_test', 'test_shortcode' );
function test_shortcode( $atts )
{
// ignore $atts
return "<div class='test'>This\ntext\n\nshould all appear\n\n\n\non one line if shortcode output is untouched.</div>";
}
@szbl
szbl / ryan.php
Last active August 29, 2015 14:06
<?php
$obj = new stdClass();
echo 'Object in var: ';
var_dump( $obj == true );
echo '<hr>';
echo 'Non-existent var: ';
@var_dump( $nonexistent_obj == true );
--
-- Basic update for site URL, does not update hard-coded content URLs but
-- should update properly generated permalinks and the basic site settings.
--
UPDATE wp_options
SET option_value = REPLACE( option_value, 'http://www.oldhostname.com', 'http://www.newhostname.com' )
WHERE option_value LIKE 'http://%';
<div class="col-sm-6 col-md-4"><div class="thumbnail" style="
background: red;
border: 0;
"><div class="caption" style="
background: #fff;
padding: 0;
min-height: 318px;
margin: 0 3px;
"><h3 style="
color: #fff;
-- Update options (site url, home)
--
UPDATE wp_options
SET option_value = REPLACE( option_value, 'http://url1', 'http://url2' )
WHERE option_value LIKE 'http://%';
-- Update post content
--
UPDATE wp_posts
SET post_content = REPLACE( post_content, 'http://url1', 'http://url2' );
# Download, extract, move and delete WordPress source.
cd /path/to/project/docroot/
wget http://wordpress.org/latest.tar.gz
tar zxvf latest.tar.gz
mv wordpress/* ./
rm -rf latest.tar.gz wordpress
# now hit the URL in your browser and install ;]
# assume: /path/to/sql/file/mydb.sql
cd /path/to/sql/file/
mysql -u root -p
# passord
> use mydb;
> \. mydb.sql
<?php
add_filter( 'gform_pre_render_1', 'szbl_gform_render_test' );
function szbl_gform_render_test( $form )
{
foreach ( $form['fields'] as $key => $field )
{
if ( 'select' == $field->type )
{
if ( 5 == $field->id )