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
    How I Stopped WordPress Comment Spam

    I love almost every part of being a tech blogger:  learning, preaching, bantering, researching.  The one part about blogging that I absolutely loathe:  dealing with SPAM comments.  For the past two years, my blog has registered 8,000+ SPAM comments per day.  PER DAY.  Bloating my database...

  • By
    I’m an Impostor

    This is the hardest thing I've ever had to write, much less admit to myself.  I've written resignation letters from jobs I've loved, I've ended relationships, I've failed at a host of tasks, and let myself down in my life.  All of those feelings were very...

Incredible Demos

  • By
    MooTools-Like Element Creation in jQuery

    I really dislike jQuery's element creation syntax. It's basically the same as typing out HTML but within a JavaScript string...ugly! Luckily Basil Goldman has created a jQuery plugin that allows you to create elements using MooTools-like syntax. Standard jQuery Element Creation Looks exactly like writing out...

  • By
    MooTools dwCheckboxes Plugin

    Update / Fix: The checkboxes will no longer toggle when the "mouseup" event doesn't occur on a checkbox. Every morning I wake up to a bunch of emails in my Gmail inbox that I delete without reading. I end up clicking so many damn checkboxes...

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!