If you’re looking for a fast, user-friendly tool to check broken links on a page you’re currently viewing, the Check My Links Google Chrome extension is pretty nice. Links that are good are highlighted in green and ones that are bad are highlighted in red.
Category: Web Development
Easily Test / Browse Websites in Print CSS Mode
While most people don’t feel the need nor want to print websites anymore, some people still print them. Developing a website to see how it looks when printed can be a hassle. You can keep printing your pages on paper until you get things to look right or you can keep previewing how it would look in your browser’s print dialog window. You can also temporarily change the CSS media of your print CSS to “screen” while you develop. Fortunately, if you use Google Chrome, there’s an ever easier way as pointed out by my colleague, Keith Shaw, the other day. If you open a page in Chrome and Chrome’s Inspector, you can hit the escape button to toggle additional controls as shown in the screenshot below. With the control panel open, click “Emulation”, “Screen”, and check the “CSS Media” checkbox with the media selection set to “print”. You can then view how your pages will look when printed right in your browser and easier adjust CSS styles instantly.
Screen Ruler for Windows
When developing websites, I often find myself needing to measure the length of elements and aligning elements. One very useful tool for doing is is a screen ruler. The best one I’ve found is called “A ruler for Windows.” It has many features including the ability to make the ruler horizontal and vertical. Below is a screenshot of how it looks on this website.
Overlap a Semi-Transparent Web Browser Over a Photoshop PSD Design for Precise Web Development
Converting a website design in Photoshop to an actual website with pixel perfect accuracy can be quite challenging. One thing you can do to simplify this process is by overlaying a semi-transparent browser over your Photoshop design and then using a development tool like Chrome’s Inspector or Firebug to adjust page elements until that match the underlying design. To do this in Windows 7, you’ll need to enable an Aero theme which is in the Personalization Control Panel item.
Continue reading Overlap a Semi-Transparent Web Browser Over a Photoshop PSD Design for Precise Web Development
Bulk HTTP Header Response Checker
Every now and then I’d upload a bunch of docs and would like to quickly check verify that they are all live and that I don’t get any 404s (file not found errors). One nice tool for checking this is httpstatus.io. Just copy and paste a bunch of URLs (up to 100) into the text area and submit and you’ll get a response for all URLs quickly and easily.
Javascript Countdown Timer
If you want to create a countdown timer for your website, you can do so with Javascript. But, there are some things you need to look out for concerning dates. Below is a code snippet for creating a Javascsript countdown timer.
$(document).ready(function() { // set the date we're counting down to // if the target date should be local to a user's time zone, e.g. the next new year, // then just enter the date, e.g. "Jan 1, 2015 00:00:00" // if the target date should be fixed to one time zone, // e.g. for a live, online event that will take place at the same time regardless of a user's time zone, // then enter the date in universal format, e.g. Apr 24, 2014 10:00:00 GMT-0700 // this example is for a target date that is on April 24, 2014 at 10 AM Pacific time (USA) var target_date = new Date("Apr 24, 2014 10:00:00 GMT-0700").getTime(); // variables for time units var days, hours, minutes, seconds; // get tag element var countdown = document.getElementById("countdown"); // update the tag with id "countdown" every 1 second var timerId = setInterval(function () { // find the amount of "seconds" between now and target var current_date = new Date().getTime(); var seconds_left = (target_date - current_date) / 1000; // do some time calculations days = parseInt(seconds_left / 86400); seconds_left = seconds_left % 86400; hours = parseInt(seconds_left / 3600); seconds_left = seconds_left % 3600; minutes = parseInt(seconds_left / 60); seconds = parseInt(seconds_left % 60); // insert the time $days.text(days); $hours.text(hours); $minutes.text(minutes); $seconds.text(seconds); }, 1000); });
Regular Expressions: Greedy vs Lazy Specifiers
Let’s say you want to match all href values in <a> tags in an HTML document. You might do something like
href=”.*”>
But that doesn’t work because the * is greedy and gets everything up until that last closing bracket on the first line. To fix this, make the * lazy but adding a question mark (?) after it.
href=”.*?”>
Notice now that we correctly get 3 matches instead of 2.
Fix CSV Files & Import/Export Them Using MySQL & Excel
Recently I had to do my taxes and having an online store, I had to go through 9000 transactions in Paypal that I needed categorize. Paypal lets you download your transaction history as a csv (comma-delimited text) file with double quotes (“) as a text qualifier which is a standard format. Unfortunately, you can still run into problems if you have double quotes and commas in a field’s value as follows:
“Confirmed”,”8″”, 10″”, 12″” AR550 Gong Round Steel Shooting Target Set 1/2″” Thick ( AR500)”,”300977807743″,”0.00″,”0.00″,”0.00″,””,””,””,””,”Ebay”, ….
Notice that the 2nd field contains double quotes and commas as follows:
8″”, 10″”, 12″” AR550 Gong Round Steel Shooting Target Set 1/2″” Thick ( AR500)
The original text for this field is
8″, 10″, 12″ AR550 Gong Round Steel Shooting Target Set 1/2″ Thick ( AR500)
where the double quotes represent inches as a unit of measure and the comma indicates that there are multiple sizes (8 inch, 10 inch, and 12 inch). The double quotes were escaped with double quotes to indicated that the double quotes are part of the field’s value. However, a double quote followed by a comma messes everything up because there’s no way to know whether that comma is part of the field value or a field delimiter.
The fact that this field contains double quotes and commas breaks the csv format because it appears now that this row has more columns that those in other rows. This is one of many things that can break a csv file. To fix this and other issues, I have found that it is most easy to use a tool called CSV Easy. It’s fast and shows you clearly which rows need to be fixed. Here’s an example of the problem I faced earlier.
Continue reading Fix CSV Files & Import/Export Them Using MySQL & Excel
A Better Calculator for Windows
If you need a calculator that shows many calculations so that you don’t have to write down and remember what previous calculations were, you can use CalcTape. I have found it to be most useful.
Document Ready VS Load Events
$(document).on(‘ready’, handler)
// executes when HTML-Document is loaded and DOM is ready. Assets like images maybe still are missing. The DOMContentLoaded event is fired.
$(window).on(“load”,handler)
// executes when complete page is fully loaded, including all frames, objects and images;
You can see what assets are loaded before and after a document is ready by viewing the Network panel in Chrome’s inspector. The Load event is fired.
The blue line indicates when the document is ready and the red line when the window (page / document) has loaded.
At the bottom, you can see how long it took for the document to be ready (614 ms) and how long for the window to load (3.81 s).