What's happening on your site right now?

Find out with GoSquared. Real-time web analytics.


Try GoSquared Free.

Archive for October, 2007

Last year was only the Beginning

James Gill / October 22, 2007

Get Seen in 19,600 pixels

Welcome to GoSquared.

Between now and Christmas, GoSquared will become more than you ever imagined.

Check back daily to find out more.

Updating the servers. Oh what fun.

James Gill / October 18, 2007

liquidicity temporarily down, back now

Media Temple are great hosts. Well, most of the time. Yesterday they performed upgrades to almost all of their dedicated servers, including ours, and most went well, without a hitch. Not ours.

Due to a lot of the complexities behind Squares (that seemingly simple ad system), we use PHP 5 amongst other technologies that Media Temple hadn’t remembered about. Upon updating, they managed to mess a few things up related to PHP, and with our site almost entirely built on the technology, we couldn’t do much other than sit around and bark at (mt) to get them to fix it faster.

Eventually, after a good few hours, well, actually almost a whole day, we were back.

Let’s hope the so-called updates aren’t quite so damaging in future!

Thanks for your patience,

GoSquared

Identify unused CSS [Improved]

Geoff Wagstaff / October 13, 2007

Unused CSS Cleaner Upper

Thanks to Damian over at http://level0.ch/ for bug fixes and feature additions. The original script was written quickly and was intended for simple usage, but he has kindly taken the time to extend the functionality of the script and provide the world with an even better utility!

Improvements include:
- output prefixed with “.” respectively “#” to distinguish classes and id’s
- support for multiple html / css pages (as in larger projects) added, use a comma-separated list as “page” parameter
- added an optional parameter “visual” which will make the script print the evaluated css and html to the browser window.

I’ve fixed a few bugs with his new code and am continually expanding this script to include more functionality, so check back for more up to date versions!

CLICK HERE to reveal the rest of the code

<?php
/********************************************************************\
* GoSquared ltd.                                    |css_checker.php *
* Authors: Main code by Geoff http://www.gosquared.com               *
* Extended by Damian http://level0.ch/                               *
* Adapted to OOP by Geoff                                            *
* Date: 10/07                                                        *
* Version: 1.2.0                                                     *
*--------------------------------------------------------------------*
* THIS SCRIPT IS OPEN SOURCE AND MAY BE USED BY ANYONE. SUBSEQUENTLY,*
* THE AUTHORS ACCEPT NO RESPONSIBILITY FOR ITS USAGE NOR GURANTEE ITS*
* RELIABILITY. NONE OF THE AUTHORS STATED ABOVE CAN BE HELD RESPONSI-*
* BLE FOR PROBLEMS RESULTING FROM THE USAGE OF THIS SCRIPT           *
*********************************************************************/
 
class css_scanner{
	public $helptext = "<p>
		<h3>Identify unused CSS</h3>
		Main code: <a href=\"http://www.gosquared.com/liquidicity/archives/203\">http://www.gosquared.com/liquidicity/archives/203</a> by Geoff<br />
		Bug fix & more: <a href=\"http://level0.ch/fileserv/csschecker.php.html\">http://level0.ch/fileserv/csschecker.php.html</a> by Damian<br />
		Further development, bug fixes and additions by Geoff<br />
		<b>Usage:</b><br />
		<ul>
		  <li>http://www.myserver.com/csschecker.php?page=index.html</li>
		  <li>http://www.myserver.com/csschecker.php?page=http://www.another-server.net/index.html</li>
		  <li>http://www.myserver.com/csschecker.php?page=index.html,about.html,download.html</li>
		  <li>http://www.myserver.com/csschecker.php?page=index.html&visual=inline</li>
		  <li>http://www.myserver.com/csschecker.php?page=index.html&visual=iframe</li>
		</ul><br />
		CSS Scanner will look for and scan any embedded or external CSS files in your HTML code.
		  </p>";
	public $page_content = '';
	public $unused = array();
	public $multi_page;
	public $page;
	public $page_content_visual;
 
	function __construct($page){
		//$multi_css = explode(',', $css);
		if(empty($page)){
			echo "No page specified to scan" . $this->helptext;
			exit;
		}
 
		$this->multi_page = explode(',', $page);
		//$css_content = '';
 
		if(count($this->multi_page) > 1){
			$i = 0;
			$this->page_content = array();
			foreach ($this->multi_page as $page) {
			    $this->page_content[$i] = file_get_contents($page);
			    $i++;
			}
		}
		else{
			//$css_content .= file_get_contents($css);
			$this->page = $page;
			$this->page_content = file_get_contents($page);
		}
 
		if(is_array($this->page_content)){
			$i=0;
			foreach($this->page_content as $page_content){
				$this->page = $this->multi_page[$i];
				$this->page_content_visual = $page_content;
				$this->unused = $this->scan($page_content);
				$this->print_report();
				$i++;
			}
		}
		else{
			$this->page_content_visual = $this->page_content;
			$this->unused = $this->scan($this->page_content);
			$this->print_report();
		}
	}
 
	function scan($page_content){
		$i = 0;
		if(ereg("<style( *[\n]*.*)>\n*(.\n*)*<\/style>", $page_content)){
	        if(preg_match_all("/(@\s*import\s* (url((\"|')?)?((\"|')?)|(\"|'){1}).+(\"|')?\)?)/", $page_content, $ext_stylesheets)){
	            foreach($ext_stylesheets[0] as $stylesheet){
	                $css_content[$i] = preg_replace("/(@\s*import\s*)|(url\(?((\"|')?))|(\"|'){1}|\)?(\"|')?;|(\s)/", "", $stylesheet);
	                $i++;
	            }
	            $array = 1;
	        }
	        $inline_notused = $this->check_file($page_content, $page_content);
	    }
	    else die("No page styles, sorry!".$this->helptext);
 
	    $unused = array('internal' => array(), 'external' => array());
 
		if(isset($array) && $array == 1){
			foreach($css_content as $css_file){
				$css = file_get_contents($css_file);
				if(!empty($css)){
				    $not_used = $this->check_file($css, $page_content);
				    array_push($unused['external'], array('css_file' => $css_file, 'external' => $not_used));
				}
			}
		}
		if($inline_notused != false){
			$unused['internal'] = $inline_notused;
		}
		return $unused;
	}
 
	function print_report(){
		echo "<h1>Report for page: ".$this->page.'</h1>';
		foreach($this->unused['external'] as $unused){
			echo 'CSS entries not used from external CSS file '.$unused['css_file'].':<br />';
		    if(count($unused['external']) > 0){
		    foreach($unused['external'] as $entry){
		        echo $entry.'<br />';
		    }
		    }else echo 'None, good job!';
		    echo '<br /><br />';
		}
	    if(count($this->unused['internal'] > 0)){
		    echo 'CSS entries not used from internal CSS code block:<br />';
		    foreach($this->unused['internal'] as $entry){
		        echo $entry.'<br />';
		    }
		    echo '<br /><br />';
		}
		if(isset($_GET["visual"]) && $_GET['visual'] == 'iframe'){
		   echo "<hr><iframe src = \"$this->page\" width=\"100%\" height=\"100%\"></iframe>";
		}
		elseif(isset($_GET["visual"]) && $_GET['visual'] == 'inline'){
			echo "<hr>",
			    $this->page_content_visual;
		}
	}
 
	function check_file($css, $page_content){
		preg_match_all("/\.([a-zA-Z-_][a-zA-Z0-9-_]+)({|[\s].*{)/", $css, $css_classes);
		preg_match_all("/#([a-zA-Z-_][a-zA-Z0-9-_]+)({|[\s][^;]*{)/", $css, $css_ids );
		preg_match_all("/<[a-zA-z0-9][^>]*class\s*=\s*[\"'](.+?)[\"']/", $page_content, $page_classes);
		preg_match_all("/<[a-zA-z0-9][^>]*id\s*=\s*[\"'](.+?)[\"']/", $page_content, $page_ids);
 
		$clean_page_classes = array();
		$clean_page_ids = array();
		foreach($page_classes[1] as $s) {
		    $classes = explode(" ", $s);
		    foreach($classes as $class) {
		        array_push($clean_page_classes, $class);
		    }
		}
		foreach($page_ids[1] as $s) {
		    $ids = explode(" ", $s);
		    foreach($ids as $id) {
		        array_push($clean_page_ids, $id);
		    }
		}
 
		$not_used = array();
		foreach($css_classes[1] as $css){
		    if(!in_array($css, $clean_page_classes) && !in_array('.'.$css, $not_used)){
		        array_push($not_used, '.'.$css);
		    }
		}
		foreach($css_ids[1] as $css){
		    if(!in_array($css, $clean_page_ids) && !in_array('#'.$css, $not_used)){
		        array_push($not_used, '#'.$css);
		    }
		}
		return (count($not_used) > 0) ? $not_used : false;
	}
}
 
$scanner = new css_scanner($_GET['page']);
?>

I hope this helps you out!

You might also like: Some People Just Don’t Get Interfaces…, Download ANY file from ANY site using Safari, Love Colour? Love These..

GoSquared – Who’s Getting Seen?

James Gill / October 10, 2007

GoSquared Get Seen

The only way to get seen on liquidicity is to purchase a Square [or make an awesome product and tell us about it].

A lot of people aren’t sure why they would want to buy a Square, or who’s going to see them if they do buy one.

To all those that have already bought a Square, here’s some extra publicity…

Media Temple

MT

Media Temple have already experienced a number of new users after we started promoting them with a Square. Just one Square, and we became partners. Media Temple are a top notch hosting company and we highly recommend them.

Adii

Square Unavailable

Adii is a great blog that shares many interests with us and the loyal readers of liquidicity. If you like liquidicity, you’ll probably also like Adii.

ColourLovers

ColourLovers

We’ve been in contact with ColourLovers for a while now, and we admire their passion for what they do. Their site has gone from strength to strength and seems to constantly be getting Dugg. If you want to know about colour, look no further.

WaffleBox

WaffleBox

An amusing blog on design, web, and modern technology. As they put it, “Somewhere between philistine and high art.”

MediaElements

MediaElements

MediaElements is a London based advertising agency who came to us looking for someone to design their website. We completed a successful site, are providing hosting, and of course, promote them with a Square on GoSquared and liquidicity.

We will be growing GoSquared over the next few weeks, and if any loyal readers want to get seen and support us at the same time we could really do with some new customers!

Buy a Square

GoSquared, Get Seen. We need your support like never before.

40 Apple Product Vector Icons – Mac Vectors, iPod Vectors, iPhone Vectors

James Gill / October 5, 2007

Apple Vector Icons - free to download from GoSquared

Wow, it’s been a tough couple of weeks, and we thought another set of vector icons was long overdue. This time, we’ve gone Apple flavoured.

So here is something to keep you ticking over: a sample of vector icons of all your favourite (or perhaps most hated) Apple products, from iPods and iPhone to iMacs and the Apple Remote.

We hope you enjoy them and, as always, you’re free to use them however you want.

New to GoSquared? Say hello – we don’t bite.

For those of you new to GoSquared – we help people improve their websites. GoSquared real-time web analytics enables you to understand what’s happening on your site right now. We run this blog, on design, technology and marketing to share our thoughts and content with wonderful people like you in the hope that you’ll also try GoSquared.

Ai Get the Adobe Illustrator CS2 File (2.0MB)

Get the svg here. (652KB)

Get the jpeg here. (118KB)

Icons Set Apple Preview

Pay whatever you want

We put considerable effort into the resources we make. We’re asking anyone who actually gets some use out of these icons and buttons to pay for them, and for the time we spent creating them. We won’t set the price point, so pay whatever you like. Hate them? Don’t pay anything!


Using these icons commercially

If you want to use these icons and buttons commercially (on your company’s website, in client work, in any scenario where you’ll be profiting from the work they’re in) then we kindly request that you donate at least $40 to justify the time and effort we’ve put in to creating them. It wasn’t a small job, and your money goes directly back in to creating more quality design resources.