Skip to content

Instantly share code, notes, and snippets.

View pjhoberman's full-sized avatar

PJ Hoberman pjhoberman

  • Denver, Colorado
View GitHub Profile
$.extend( {
updateBlock: function(url, options, callback){
$.updateBlock.defaults = {
formatDate: false
}; // defaults
$.updateBlock.options = $.extend({}, $.updateBlock.defaults, options || {});
console.log( $.updateBlock.options );
$.extend( {
updateBlock: function(url, options, callback){
// this stuff isn't needed right now, but it's for adding options
$.updateBlock.defaults = {
//formatDate: [] // expects an array of ids to format
}; // defaults
$.updateBlock.options = $.extend({}, $.updateBlock.defaults, options || {});
<!--[if lt IE 7]>
Whatever you want only people using less than ie7 to see
<![endif]-->
Example:
<!--[if lt IE 7]>
<script type="text/javascript">
<?php
phpinfo();
?>
<?php
echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";
echo '<pre>';
$browser = get_browser(null, true);
print_r($browser);
?>
<?php
if( preg_match( '/MSIE (\d*\.\d*)/', $_SERVER['HTTP_USER_AGENT'], $matches ) ){
if( $matches[1] < 7 ) {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
}
} // if
?>
// wrapper to prevent ie erroring out on leftover console.logs
function log(log)
{
if( typeof console !== "undefined" )
console.log( log );
} // log
/* include this file with livecss.js
* add a querystring param livecss, set to true
* example: http://yourawesomesite.com/somefile.html?livecss=true
* live css will watch on every reload as long as the querystring is there and true
*/
function getParameterByName( name )
{
// copied from http://stackoverflow.com/questions/901115/get-querystring-values-with-jquery
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
// ajax to html what what
$.extend( {
updateBlock: function(url, options, callback){
var defaults = {
round:false
}; // defaults
options = $.extend({}, defaults, options || {});
$.getJSON(url, function(data, these_options){
<?php
header();
?>
Stuff
More Stuff
<?php