Better tooling for web developers

Better tooling for web developers

Here’s a great video collecting ways to be efficient by Paul Irish. He’s promoting something called Yeoman which is a web dev bootstrapping project.

Highlights include:

  • LiveReload (changing a file on the desktop and the browser refreshing for you (!!!)
  • Inline JavaScript linting with Sublime
  • SourceUrls for compiled coffeescript in developer tools
  • Many ways to test: in browser, on command line, post push, in the cloud for every device….

Yeoman does a ton of stuff, although there are other ways to accomplish those same tasks: compress images, auto-update external libraries, minification

Sublime Text 2 alone is a huge leap forward as far as tooling goes. I just started using it and I don’t know how I ever lived without it.

With ZenCoding you type:

.test-zen>h1+p

and it becomes

<div class=”test-zen”>
  <h1></h1>
  <p></p>
</div>

Wahoo!

The video has a huge amount of “stuff.” Adopting these tools and changing one’s habits takes effort, but doing so is definitely a level up.

JavaScript is hardly ever your web performance bottleneck

JavaScript is hardly ever your web performance bottleneck

I’ve noticed that it’s common for web developers to charge ahead with the assumption that JavaScript is making their web application slow. While poorly-tuned JavaScript might contribute to performance issues, most of the time it’s minor and distracting developers from bigger, simpler wins.

Make sure you check off all of the web performance best practices before performance-tuning your JavaScript; serve everything gzipped, avoid redirects, fully optimize images (smushit), include JavaScript at the bottom of the page and definitely after CSS, combine and minify css/js…etc.

Here’s the original Steve Souders list of best practices and an extended web performance best practices list from Yahoo.

Also install and use Google Page Speed Insights in your browser. Google has an ulterior motive for helping you make your site faster, so you can rely on that advice.

You can also use FrontendTest as an additional weighted web performance audit.

If you’re working on a JavaScript framework or very commonly used plugin, like JQuery or something, that many people use, well then go ahead and tune your JavaScript. Are you John Resig, for example? Probably not. Please use web performance best practices to make your site faster.

Another Responsive Résumé Template

Another Responsive Résumé Template

I’ve been wanting to share the HTML5 responsive résumé I built from scratch, but I hemmed and hawed thinking “Who even codes HTML resumes anymore? Don’t people just fill in their LinkedIn profile?” But hang on! It IS important. If you are a web developer and you want an awesome job at some super cool startup, then your resume should look good, even on a phone, and your source code should be HTML5 and marked up with semantic value.

And just as importantly, if you’re an employer, you probably want to view source on a web developer’s résumé.

I was validated by A List Apart when they published A Case for Responsive Resumes and instad of thinking “Oh, well, it’s been done”, I’m finally sharing mine also, because there can never be enough responsive résumé templates.

You can download the files from github like this:

-> mkdir resume
-> git clone https://github.com/annr/responsive-resume.git resume

Here’s my live responsive resume.

Here’s a link to the template that you would customize: template.html

To customize the template, simply replace whatever appears in braces — eg. {Your Name} — with your information.

Here’s an example desktop screenshot:
Responsive resume example desktop view

And here’s an example phone screenshot:
Responsive resume example mobile view

Enjoy!

Replace images with CSS gradients for striped backgrounds

Replace images with CSS gradients for striped backgrounds

One of the easiest and most effective ways of speeding up a web site is to replace background images with CSS3. Currently I’m exploring, and trying to have a very good understanding off, all the ways we can use CSS3 to create layouts instead of resorting to using images that create http requests and slow down pages, especially on mobile devices.

The site I happen to be working on has three different backgrounds with vertical stripes. Figuring out how to replace the images it currently uses with CSS is a big win, provided that the size of the CSS required to create these backgrounds is not prohibitively large. (Background images tile and can be very small files — it’s the http request for the image that is more expensive in terms of performance.) In the case of stripes, the CSS is small.

So how do we make striped backgrounds with CSS? The place I looked for and found the answer is Lea Verou’s CSS3 Patterns Gallery. This gallery blows my mind with the possibilities of how to use CSS3 gradients to make backgrounds. What I’m doing in this example is relatively very easy; the gallery includes plaid, hearts, checkerboards and many other cool patterns.

As far as I can tell, there is no easy way to copy the cross-browser CSS from the gallery. Therefore I’ll provide it here, and show you how to take thick gray lines and create other colors and widths.

Here’s Lea’s vertical stripes background and the code to create it:

.verticalStripes {	
	background-color: gray;
	background-size: 50px;
	background-image: -webkit-linear-gradient(0, transparent 50%, rgba(255, 255, 255, .5) 50%);
	background-image: -moz-linear-gradient(0px 50%, transparent 50%, rgba(255, 255, 255, 0.5) 50%);
	background-image: -ms-linear-gradient(0, transparent 50%, rgba(255, 255, 255, .5) 50%);
	background-image: -o-linear-gradient(0, transparent 50%, rgba(255, 255, 255, .5) 50%);	
}

The backgrounds I need to re-create are blueish with very thin, subtle lines. Here’s a screenshot of one of the replaced backgrounds with the code.

.verticalStripes {	
	background-color: #99d0d4;
	background-size: 10px;
	background-image: -webkit-linear-gradient(0, transparent 90%, rgba(255, 255, 255, .25) 50%);
	background-image: -moz-linear-gradient(0px 50%, transparent 90%, rgba(255, 255, 255, 0.25) 50%);
	background-image: -ms-linear-gradient(0, transparent 90%, rgba(255, 255, 255, .25) 50%);
	background-image: -o-linear-gradient(0, transparent 90%, rgba(255, 255, 255, .25) 50%);		
}

It’s easy to take these examples and create variations. Here we are taking one color, and putting a transparent sheet of another color on top, shifted X percent. In the blue stripes example, the total width of the repeating background is 10px and the part of it that is overlapped with transparent white is 10% or 1px. We could replace 90% with 9px if we wish, but using a percentage here may be more maintainable.

What if we want two different colors, not a color and a shade of the same color? We can just take our transparent sheet and put another color, not white, on top of it. Here I’ll make red and purple stripes using red as a base color and blue as the overlay.

.verticalStripes {	
	background-color: #ff3300;
	background-size: 50px;
	background-image: -webkit-linear-gradient(0, transparent 50%, rgba(0, 0, 255, .5) 50%);
	background-image: -moz-linear-gradient(0px 50%, transparent 50%, rgba(0, 0, 255, 0.5) 50%);
	background-image: -ms-linear-gradient(0, transparent 50%, rgba(0, 0, 255, .5) 50%);
	background-image: -o-linear-gradient(0, transparent 50%, rgba(0, 0, 255, .5) 50%);	
}

Easy!

As you can see this is very flexible. I’d challenge you to find a striped background that can’t be replaced with CSS. If you want red and green stripes, you might need to find another solution, like a background image. But if you want red and green stripes — the idea alone gives me a headache — you could be deliberately punishing your user anyway, and you might further torture them with a slow page.

File under: big wins.

I Heart My Robot: FrontendTest.com

I Heart My Robot: FrontendTest.com

Woohoo! I made the leap from web developer to entrepreneur.

I’ve created a web app for testing front-end code that I’m hoping I can one day soon call “The most comprehensive web site testing tool.”

I think it may already be the most comprehensive tool — READ: it tests a bunch of random things — but before I call anything I want to make sure that it works very well.

It’s different than any web site testing tool I know about. I doesn’t just spit out a bunch of line numbers with errors and warnings. It looks at your site holistically, gathers issues, sorts them, and delivers a report telling you what you should address first, and why it matters.

In this way it’s more of a hand-holding experience. I imagine it to be like a robot from an old sci-fi movie. It loves the flawed human captain of the ship, and it wants to deliver the best advice, based on data, in a soothing artificial voice that very hardly syncs with a pulsing red light. I will call the robot FET.

Please use it, it’s free and helpful: FrontendTest.

A Nice Call to Action Button

A Nice Call to Action Button

We are replacing our large image buttons with markup. Yay! I think what our designer came up with is quite nice, and easy to build with CSS3, so I’m sharing it.

Sample Button

Here is the CSS:

.button2012 {
   border: 1px solid #c95d00;
   background: #fa962f;
   background: -webkit-gradient(linear, left top, left bottom, from(#fa962f), to(#ee7106));
   background: -webkit-linear-gradient(top, #fa962f, #ee7106);
   background: -moz-linear-gradient(top, #fa962f, #ee7106);
   background: -ms-linear-gradient(top, #fa962f, #ee7106);
   background: -o-linear-gradient(top, #fa962f, #ee7106);
   padding: 5px 20px;
   -webkit-border-radius: 6px;
   -moz-border-radius: 6px;
   border-radius: 6px;
   text-shadow: rgba(20,20,20,.6) 0 1px 0;
   color: white;
   font-size: 18pt;
   font-weight: bold;
   text-decoration: none;
   vertical-align: middle;
   cursor: pointer;
}
.button2012:hover, .button2012:active {
   background: #ee7106;
}

You can make the button and the hover any color you want, of course, although A/B tests have shown that red buttons convert better.

The Difficult Search for Front-end Engineers

The Difficult Search for Front-end Engineers

My company, Prosper.com, is having a difficult time finding front-end engineers. We’ve gone through many résumés, screened many people, and brought in a few for interviews. But none have the chops. This has made me very thoughtful about my role and my career.

A coworker of mine said that she knew several recently jobless people who know “more than front-end” as if the “more than” would sell them to me. I might have been kind of rude when I said “I don’t want more than front-end.” I just want a couple people who know front-end development well.

I think the role is under-appreciated by everyone. A service we used to find engineers matched us with back-end programers, but their front-end candidates were all a bust. Why? Because even professional technology screeners don’t know what to look for and there are very few good front-end web developers. The difference between Paul Irish and 99% of web developers is vast. The job seems easy perhaps, but a foundation is key.

For example, many front-end engineers (all I’ve interviewed) do not know CSS specificity well. That is, they don’t know the rules that determine what style an element will have. This is important to know! It removes the guesswork from styling and saves developers a lot of time. And if you don’t know it well, you will write poor markup and CSS and create hell for your client and anyone who inherits your code. You curse them basically, forcing them to write even worse markup and CSS to gain control.

Here is a list of questions I’m asking front-end candidates this week. I’ll also give the kinds of answers one would want to hear, so that screeners have a guide.

What are the rules that determine what style will be applied to an element?

element -> class -> id -> inline

———–> (increasing specificity)

(!important) element ->  class -> id -> inline

———–> (increasing specificity)

Why would you use a JavaScript framework?

1) reduce cross-browser worries. 2) cleaner, simpler code. 3) plugin library.

What are some elements introduced with HTML5?

Ex. video, audio, canvas, aside, section, nav, footer, time, input type=”tel”, input type=”email”….etc.

How might you use new HTML5 elements while supporting browsers that do not recognize the new elements?

HTML5shim (“shiv”) for < IE 9.

What are some neat things you can do with CSS3?

Animations and transformations. Alpha transparency…

What online resources do you use?

MDN would be a good answer. W3Schools would not be.

What are your favorite webdev blogs?

Remy Sharp, Paul Irish, adactio.com, CSS-Tricks, A List Apart

What’s a closure?

Enclosing code in a function, and a good practice.

How might you keep a resource from being cached on the front-end?

Add a random string as a query parameter to the resource URL.

What are some ways to improve page speed?

Defer JavaScript, minify and combine linked resources, use better compression for images, use the Google Library API for common scripts, CDN, image sprites…

What is the last web development book you read?

Introducing HTML5, The Book of CSS3, Mobile First are good examples.

How might you transfer state between pages?

Cookies, HTML5

When would you use gif, jpeg and png?

PNGs compress better than GIFs and are very well supported by modern browsers, so use PNGs. JPEGs for photos. GIFs for simple animations possibly if you had to.

When would you use Flash, Canvas and SVG?

Canvas elements are raster images and so if you want to manipulate pixels, use canvas. SVG is vector art. Don’t use Flash.

 

Relic Source Found

Relic Source Found

I got a blank page today, and I wondered why. So I looked at the source, and these are the contents:

<title></title></head>
<!– Redirection Services SJL01WRED05 H1 –>
<frameset rows=’100%, *’ frameborder=no framespacing=0 border=0>
<frame src=”http://www.somedumbwebsite.com/index2.htm” name=mainwindow frameborder=no framespacing=0 marginheight=0 marginwidth=0></frame>
<frame src=”/?a8734haka8dr781346=true” NAME=a33 frameborder=no framespacing=0 marginheight=0 marginwidth=0></frame>
</frameset>
<noframes>
<h2>Your browser does not support frames.  We recommend upgrading your browser.</h2><br><br>
<center>Click <a href=”http://www.somedumbwebsite.com/index2.htm”>here</a> to enter the site.</center>
</noframes></html>

Upgrade my browser to support frames?! When could this have been written? Was there a time when frames were a new feature that old browsers didn’t support as opposed to an old features that new browsers do not? Wow.

Seems evil — no title, just frames. Good thing I got a blank page!

The Difference Between Pseudo-Classes and Pseudo-Elements

The Difference Between Pseudo-Classes and Pseudo-Elements

A pseudo-class is a feature of an HTML element that can be styled but is not available via the document tree. Pseudo-classes are often used with the anchor tag: a:link, a:hover, a:visited, and a:active. Some pseudo-classes can accept values such as lang :lang pseudo-class: p:lang(fr), :lang(de).

Pseudo-elements are abstract sub-elements of an html document: ::first-letter and ::first-line are examples.

If you were an HTML element the state of your eyes being closed, open or squinting would be a pseudo-class, and your pinky toe would be a pseudo element. Go ahead and do this exercise yourself to sort pseudo-classes and pseudo-elements. :) What would your grandmother be? (hint: “behind”)

Previously, pseudo-classes and pseudo-elements have looked exactly the same: element:pseudo-something. Which is kind of nasty considering the mental energy that goes into separating these ideas. But the Level 3 recommendation has improved the visual distinction. Pseudo-classes continue to use one colon, and pseudo-elements, going forward, use two.

Pseudo-elements with one colon will always be supported for existing pseudo-elements, but that’s not true for pseudo-elements that are introduced, so we aught to get in the habit of using two colons.

Burn the following selectors into your mind:

::after
::before
::first-letter
::first-line
::selection

and to contrast:

:target
:focus
:enabled
:disabled

Should we worry about browser support for the new syntax of pseudo-elements? Nah, progressive enhancement, Baby! It is indicated that earlier versions of Internet Explorer do not support two colons but I have confirmed that IE 8 supports all, with the exception of ::selection, perhaps. In this case I would use two colons and not try to write both in your style sheets.

Dingbats and Symbols for Web Developers

Dingbats and Symbols for Web Developers
Dingbats and Symbols for Web Developers

Here are some nice symbols which you can simply and safely use to decorate web pages. I’ve confirmed these HTML entities work in IE7+, Firefox, Opera, and Webkit.

Instead of showing you all the boring symbols that water down the list making hard to find exciting ones* like poison and snowman, I’ve ordered them not by number, but by how useful I imagine they are for web development, and how “cool” I think they are.

The HTML Entities as well as the translated CSS and JavaScript hex codes are provided for your webdev convenience.

*exciting for a web developer

Glyph HTML CSS JavaScript
&#x2620; \2620 \u2620
&#x2606; \2606 \u2606
&#x2605; \2605 \u2605
&#x2604; \2604 \u2604
&#x2603; \2603 \u2603
&#x2601; \2601 \u2601
&#x262e; \262e \u262e
&#x2600; \2600 \u2600
&#x263E; \263E \u263E
&#x2654; \2654 \u2654
&#x2655; \2655 \u2655
&#x2661; \2661 \u2661
&#x2602; \2602 \u2602
&#x260E; \260E \u260E
&#x260F; \260F \u260F
&#x2614; \2614 \u2614
&#x2619; \2619 \u2619
&#x2618; \2618 \u2618
&#x261C; \261C \u261C
&#x261D; \261D \u261D
&#x261E; \261E \u261E
&#x261F; \261F \u261F
&#x262F; \262F \u262F
&#x2639; \2639 \u2639
&#x263A; \263A \u263A
&#x263B; \263B \u263B
&#x263C; \263C \u263C
&#x266A; \266A \u266A
&#x266B; \266B \u266B
&#x2666; \2666 \u2666
&#x2693; \2693 \u2693
&#x2698; \2698 \u2698
&#x2699; \2699 \u2699
&#x269B; \269B \u269B
&#x26A0; \26A0 \u26A0
&#x26A1; \26A1 \u26A1
&#x2704; \2704 \u2704
&#x2708; \2708 \u2708
&#x270C; \270C \u270C
&#x270D; \270D \u270D
&#x270E; \270E \u270E
&#x2712; \2712 \u2712
&#x2714; \2714 \u2714
&#x2717; \2717 \u2717
&#x271D; \271D \u271D
&#x271E; \271E \u271E
&#x271F; \271F \u271F
&#x2720; \2720 \u2720
&#x2721; \2721 \u2721
&#x2722; \2722 \u2722
&#x2723; \2723 \u2723
&#x2724; \2724 \u2724
&#x2725; \2725 \u2725
&#x2726; \2726 \u2726
&#x2727; \2727 \u2727
&#x2729; \2729 \u2729
&#x272A; \272A \u272A
&#x272B; \272B \u272B
&#x272C; \272C \u272C
&#x272D; \272D \u272D
&#x272E; \272E \u272E
&#x272F; \272F \u272F
&#x2730; \2730 \u2730
&#x2731; \2731 \u2731
&#x2732; \2732 \u2732
&#x2733; \2733 \u2733
&#x2734; \2734 \u2734
&#x2735; \2735 \u2735
&#x2736; \2736 \u2736
&#x2737; \2737 \u2737
&#x2738; \2738 \u2738
&#x2739; \2739 \u2739
&#x273A; \273A \u273A
&#x273B; \273B \u273B
&#x273C; \273C \u273C
&#x273D; \273D \u273D
&#x273E; \273E \u273E
&#x273F; \273F \u273F
&#x2740; \2740 \u2740
&#x2741; \2741 \u2741
&#x2742; \2742 \u2742
&#x2743; \2743 \u2743
&#x2744; \2744 \u2744
&#x2745; \2745 \u2745
&#x2746; \2746 \u2746
&#x2747; \2747 \u2747
&#x2748; \2748 \u2748
&#x2749; \2749 \u2749
&#x274A; \274A \u274A
&#x274B; \274B \u274B
&#x274D; \274D \u274D
&#x275B; \275B \u275B
&#x275C; \275C \u275C
&#x275D; \275D \u275D
&#x275E; \275E \u275E
&#x2776; \2776 \u2776
&#x2777; \2777 \u2777
&#x2778; \2778 \u2778
&#x2779; \2779 \u2779
&#x2780; \2780 \u2780
&#x2781; \2781 \u2781
&#x2782; \2782 \u2782
&#x2783; \2783 \u2783
&#x278A; \278A \u278A
&#x278B; \278B \u278B
&#x278C; \278C \u278C
&#x278D; \278D \u278D
&#x2794; \2794 \u2794
&#x2798; \2798 \u2798
&#x2799; \2799 \u2799
&#x279A; \279A \u279A
&#x279B; \279B \u279B
&#x279C; \279C \u279C
&#x279D; \279D \u279D
&#x279E; \279E \u279E
&#x279F; \279F \u279F
&#x27A0; \27A0 \u27A0
&#x27A1; \27A1 \u27A1
&#x27A2; \27A2 \u27A2
&#x27A3; \27A3 \u27A3
&#x27A4; \27A4 \u27A4
&#x27A5; \27A5 \u27A5
&#x27A6; \27A6 \u27A6
&#x27A7; \27A7 \u27A7
&#x27A8; \27A8 \u27A8
&#x27A9; \27A9 \u27A9
&#x27AA; \27AA \u27AA
&#x27AB; \27AB \u27AB
&#x27AC; \27AC \u27AC
&#x27AD; \27AD \u27AD
&#x27AE; \27AE \u27AE
&#x27AF; \27AF \u27AF
&#x2668; \2668 \u2668
&#x2638; \2638 \u2638
&#x2691; \2691 \u2691
&#x269C; \269C \u269C