Enqueue scripts and styles

<?php
//Enqueue Styles
function add_stylesheet(){
wp_enqueue_style('my_styles', WP_PLUGIN_URL . '/plugin_dir/style.css');
}

//Enqueue Javascript
function enqueue_js(){
wp_enqueue_script('my_javascript1', WP_PLUGIN_URL . '/plugin_dir/javascript1.js');
wp_enqueue_script('my_javascript2', WP_PLUGIN_URL . '/plugin_dir/javascript2.js');
}

//Actions
add_action('wp_print_styles', 'add_stylesheet');
add_action('wp_print_scripts', 'enqueue_js');
?>

Flowplayer Overlay

<a
href="http://TYPETHEVIDEOURLHERE"
style="display:block;width:500px;height:400px"
id="player">
</a>

<script type="text/javascript">

//Create Player and Overlay
jQuery(function() {

//Player
var player = $f("player", "/flowplayer/flowplayer-3.2.4.swf", {
clip: {
autoPlay: true,
autoBuffering: true,

//Close overlay when play complete
onFinish: function() {
jQuery('.close').click();
}
}
});

//Overlay
jQuery("img[rel]").overlay({

top: "center",

onClose: function() {
player.pause();
}
});

});
</script>

Create file with php

$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Bobby Boppern";
fwrite($fh, $stringData);
$stringData = "Tracy Tannern";
fwrite($fh, $stringData);
fclose($fh);

Random Hex Color

/**

* Get random color hex value

*

* @param integer $max_r Maximum value for the red color

* @param integer $max_g Maximum value for the green color

* @param integer $max_b Maximum value for the blue color

* @return string

*/
function getRandomColorHex($max_r = 255, $max_g = 255, $max_b = 255)

{

// ensure that values are in the range between 0 and 255

if ($max_r > 255) { $max_r = 255; }

if ($max_g > 255) { $max_g = 255; }

if ($max_b > 255) { $max_b = 255; }

if ($max_r < 0) { $max_r = 0; }

if ($max_g < 0) { $max_g = 0; }

if ($max_b < 0) { $max_b = 0; }

// generate and return the random color

echo '#' . dechex(rand(0, 255)) . dechex(rand(0, 255)) . dechex(rand(0, 255));

}

Stage Mouse Over/Out

stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseOverStage);

function mouseOverStage(evt:Event):void
{
//Code to run for stage mouse over
stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseOverStage);
stage.addEventListener(Event.MOUSE_LEAVE, mouseOut);
}

function mouseOut(evt:Event):void
{
//Code to run for stage mouse out
stage.removeEventListener(Event.MOUSE_LEAVE, mouseOut);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseOverStage);
}