jQuery Highlight Plugin Examples

CSS code

div.highlight { 
	background:#FFFFFF;
	border:1px solid #E0E0E0;
	font-family:"Courier New",Courier,monospace;
	overflow: hidden;
}
div.highlight pre{
	width: 100%;
	overflow: auto;
	padding:0;
	margin:0;
	font-size:13px;
	clear: both;
}

/* tabs */
div.highlight ul.tabs {
	overflow: hidden;
	padding: 5px 0 5px 0;
	margin: 0;
	list-style: none;
	border-bottom: 1px solid #E0E0E0;
	width: 100%;
}
div.highlight ul.tabs li {
	padding: 0;
	margin: 0 5px;
	float: left;
	background: none;
	border-bottom: 1px dashed #CCC;
	line-height:1.0em;
	color: #CCC;
	cursor: pointer;
}
div.highlight ul.tabs li.active {
	border-bottom: none;
	cursor: default;
}
div.element {
	flex-direction: row;
	flex-wrap: nowrap;
	flex-flow: column-reverse wrap;
}

HTML code

Hours of Operation

Tue-Thu: 10:30 - 10:00
Fri: 10:30 - 11:00
Sat: 10:30 - 11:00
Sun: 11:30 - 7:30

Specials

Suspendisse in nunc sed neque sagittis fermentum. Sed varius augue neque, sed euismod risus. Phasellus vitae massa nunc. Donec et mauris tortor. Duis nunc tortor, cursus sed gravida quis, tincidunt in orci. Morbi tristique consectetur velit quis mattis.

“Where the Burgers are BETTER”

PHP code

$a = array(array('p', 'h'), array('p', 'r'), 'o');

if (in_array(array('p', 'h'), $a)) {
    echo "'ph' was foundn";
}

if (in_array(array('f', 'i'), $a)) {
    echo "'fi' was foundn";
}

if (in_array('o', $a)) {
    echo "'o' was foundn";
}

$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');

$key = array_search('green', $array); // $key = 2;
$key = array_search('red', $array);   // $key = 1;

/* comment */

/* foreach example 1: value only */

$a = array(1, 2, 3, 17);

foreach ($a as $v) {
   echo "Current value of $a: $v.n";
}

/* foreach example 2: value (with key printed for illustration) */

$a = array(1, 2, 3, 17);

$i = 0; /* for illustrative purposes only */

foreach ($a as $v) {
    echo "$a[$i] => $v.n";
    $i++;
}

/* foreach example 3: key and value */

$a = array(
    "one" => 1,
    "two" => 2,
    "three" => 3,
    "seventeen" => 17
);

foreach ($a as $k => $v) {
    echo "$a[$k] => $v.n";
}

/* foreach example 4: multi-dimensional arrays */
$a = array();
$a[0][0] = "a";
$a[0][1] = "b";
$a[1][0] = "y";
$a[1][1] = "z";

foreach ($a as $v1) {
    foreach ($v1 as $v2) {
        echo "$v2n";
    }
}

/* foreach example 5: dynamic arrays */

foreach (array(1, 2, 3, 4, 5) as $v) {
    echo "$vn";
}

JS code (default)

$(document).ready(function(){
	//init boxes opacity
	$('#login').css('opacity', '1');
	$('#member').css('opacity', '0.52');
	
	//change boxes opacity on hover
	$('#login').hover(function(){
		$("#login").animate({'opacity': '1'}, 200);
		$("#member").animate({'opacity': '0.52'}, 200);
	});
	$('#member').hover(function(){
		$("#member").animate({'opacity': '1'}, 200);
		$("#login").animate({'opacity': '0.52'}, 200);
	});
	
	//request membership expand
	$('#request_membership').click(function(){
		$('#member_request > div:first').css('display', 'none');
		$('#member_request > div:last').css('display', 'block');
		$("#login").css('display', 'none');
		return false;
	});
	
	//back
	$('#back').click(function(){
		$('#member_request > div:first').css('display', 'block');
		$('#member_request > div:last').css('display', 'none');
		$("#login").css('display', 'block');
		return false;
	});
	
	//input 
	$('input[type="text"],input[type="password"]').focus(function(){
		$(this).parent().parent().addClass('focus');
	});
	$('input[type="text"],input[type="password"]').blur(function(){
		$(this).parent().parent().removeClass('focus');
	});
	
	initFontSize(); 
});

//scaling font size
function initFontSize() {
	ratio = $(window).width() / 1200 * 16;
	ratio = Math.floor(ratio * 100) / 100;	
	if (ratio < 11) ratio = 11;
	if (ratio > 14) ratio = 14;	
	$('body').css('font-size', ratio + 'px');
}

$(window).resize(function() {
	initFontSize();
});
$(window).trigger('resize'); 	

SQL code

SELECT * FROM stats;

INSERT INTO station VALUES (13, 'Phoenix', 'AZ', 33, 112);

DELETE FROM station WHERE long_w < 90; 

SELECT MAX(temp_f), MIN(temp_f), AVG(rain_i), id
	FROM stats
GROUP BY id;