Better Truncator

<?php

$longString ="http://google-maps.pace.com?var=ntahohk5eoui564x56oe4u564oa5oeu5aoeu5ao5u5eu56io14eui564oe";
$separator = '/.../';
$separatorlength = strlen($separator) ;
$maxlength = 25 - $separatorlength;
$start = $maxlength / 2 ;//Change to max length to truncate end
$trunc = strlen($longString) - $maxlength;

echo substr_replace($longString, $separator, $start, $trunc);

?>

Autoload Class Class

function ter_autoload($class_name){ include $class_name . '.php'; }
spl_autoload_register('ter_autoload');
if(function_exists('__autoload')){ spl_autoload_register('__autoload'); }

$classname  = new ClassName();

Auto Play Swf

//The As2 part
reset.onRelease = function() {
gotoAndPlay(2);
};

//The PHP part
<?php if(empty($_COOKIE['ps_viewed'])) setcookie('ps_viewed', 'true', time() + (60*60*24*90)) ?>

<object type="application/x-shockwave-flash" data="pickystickyvid-volume.swf" width="740" height="268">
<?php if($_COOKIE['ps_viewed'] == 'true') echo '<param name="play" value="false" />' ?>
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="bgcolor" value="#000000" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="/Scripts/expressInstall.swf" />
<param name="movie" value="pickystickyvid-volume.swf" />
</object>

Save plugin options multisite 3.1

<?php
//Snippet1 - New action for creating your buddypress submenu pages - replace 'create_my_submenu_page' with the name of your function

add_action(is_multisite() ? 'network_admin_menu' : 'admin_menu','create_my_submenu_page');

//Snippet2 - This is the form for submitting your plugin options. This works for plugins that only function on the main site, to account for plugins that are used on the network you may want to replace the update_options() with update_site_options() and check ahead of time to decide which to use.

<?php

function my_plugin_admin_form(){
if(isset($_POST['my_submit'])){
if(!isset($_POST['my_option']['my_display_tool'])) $_POST['my_option']['my_display_tool'] = 'false';//If no checked box in post set value to false

foreach((array)$_POST['my_option'] as $key => $value){//Add more my_option[FIELDNAME] to form for more fields
update_option($key,$value);
}
}
$my_display_tool = get_option('my_display_tool');
?>

<div class="wrap">
<h2>My Settings</h2>
<?php if(isset($_POST['my_submit'])) : ?>
<div id="message" class="updated fade">
<p>
<?php _e( 'Settings Saved', 'my' ) ?>
</p>
</div>
<?php endif; ?>
<form method="post" action="">
<?php settings_fields('my_settings'); ?>
<p style="margin-bottom:30px;">
<label style="display:block;" class="input_label">ON/OFF Switch:</label>
<br />
<input name="my_option[my_display_tool]" type="checkbox" <?php if($my_display_tool == 'true') echo 'checked'; ?> value="true" />
<!-- Add more my_option[FIELDNAME] to form for more fields -->
<span class="checkbox_text">Turn This On</span><br />
</p>
<p>
<input name="my_submit" type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>
</div><!-- /.wrap -->
<?
}
?>

Hyperlink Regex

var text = "https://loco.com/page1?asdf=wre&sfsd=sdf";
var reg:RegExp=/(b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig;
trace(text.replace(reg,"<a href="$&">$&</a>"));

Banned swear words

<?php
$bannedWords = array(
'anus',
'ass',
'bastard',
'bitch',
'blow job',
'blowjob',
'boner',
'bullshit',
'carpetmuncher',
'choad',
'chode',
'clit',
'cock',
'coochie',
'coochy',
'coon',
'cooter',
'cum',
'cunt',
'damn',
'dick',
'dike',
'dildo',
'doochbag',
'douche',
'dyke',
'fag',
'fellatio',
'fuck',
'fudgepacker',
'gay',
'goddamn',
'gooch',
'handjob',
'hard on',
'hell',
'homo',
'humping',
'jerk off',
'masturbate',
'erection',
'jizz',
'kooch',
'kootch',
'kunt',
'lesbian',
'lesbo',
'lezzie',
'mothafucka',
'muff',
'nigga',
'nigger',
'nut sack',
'pecker',
'penis',
'piss',
'polesmoker',
'poon',
'prick',
'punanny',
'pussies',
'pussy',
'queef',
'queer',
'rimjob',
'schlong',
'shit',
'shiz',
'skank',
'slut',
'snatch',
'splooge',
'testicle',
'tit',
'twat',
'vagina',
'wank',
'whore'
);
?>

Style Combo Box

//Bonus:  Row height for dropdown

timeDropdown.dropdown.rowHeight=40;

var myFormatWhite:TextFormat = new TextFormat();
myFormatWhite.font = "DFC GillSansLight";
myFormatWhite.size = 15;
myFormatWhite.color = 0xffffff;

var myFormatBeige:TextFormat = new TextFormat();
myFormatBeige.font = "DFC GillSansLight";
myFormatBeige.size = 14;
myFormatBeige.color = 0xa18c52;

comboBox.textField.setStyle("embedFonts", true);
comboBox.textField.setStyle("textFormat", myFormatWhite);&lt;

comboBox.dropdown.setRendererStyle("embedFonts", true);
comboBox.dropdown.setRendererStyle("textFormat", myFormatBeige);

comboBox.prompt = "Province"; //default value that won't show in the dropdown
comboBox.addItem( { label:"New Brunswick", data:"New Brunswick" } );
comboBox.addItem( { label:"Nova Scotia", data:"Nova Scotia" } );
comboBox.addItem( { label:"Ontario", data:"Ontario" } );
comboBox.addItem( { label:"Prince Edward Island", data:"Prince Edward Island" } );