Tweet for Code #3

By  on  

You don't need a thousand lines of code to make a big difference in any coding language.  Oftentimes it's quite the opposite:  a few tiny code snippets can do a world of good and accomplish big things.  I asked my Twitter followers to tweet to me their favorite tiny snippets of code -- that's a bit difference to try to pack into 140 characters!  Here are my favorites from this round!

Anagram Check

Anagrams are cool, and I'm gonna let ya finish, but this is the smallest checker code of all time!

Text Display Optimization

Sometimes fonts don't display optimally on all devices, so let the device browser help:

Equal Width Table Cells

We all know that tables are a pain to work with but this snippet ensures cells stay equal in width:

Slide Title Centering

This gem from Ana Tudor vertically centers a slide title when using HTML/CSS/JavaScript slides...which you should be using!  Death to Keynote and Powerpoint!

Floating Point Fix

Floats in JavaScript can be a pain point to those who don't already know about the issue.  Here's the fix to keep in mind:

Closing a Browser Tab

This blog post will now self-destruct...

Until the next Tweet For Code!

Recent Features

  • By
    Facebook Open Graph META Tags

    It's no secret that Facebook has become a major traffic driver for all types of websites.  Nowadays even large corporations steer consumers toward their Facebook pages instead of the corporate websites directly.  And of course there are Facebook "Like" and "Recommend" widgets on every website.  One...

  • By
    9 More Mind-Blowing WebGL Demos

    With Firefox OS, asm.js, and the push for browser performance improvements, canvas and WebGL technologies are opening a world of possibilities.  I featured 9 Mind-Blowing Canvas Demos and then took it up a level with 9 Mind-Blowing WebGL Demos, but I want to outdo...

Incredible Demos

Discussion

  1. Anonymous

    The replace() + split() in the anagram checker can be written as match(). In Firefox 30.0:

    function isAnagram(a,b){x=[for(x of[a,b])x.toLowerCase().match(/[a-z]/g).sort().join()];return x[0]==x[1]}
    

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!