Tweet For Code #4

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!

ES6 Array Initialization

Here are a few clever ways to initialize an array with ES6:

Short syntax for dynamic result!

Remove Wrapping HTML with inner/outerHTML

This neat little trick allows you to remove a wrapping element and re-parent the child in one operation.

Of course you would brick your event connections but this is a neat trick.

3D Body Elements

Want a 3D look at a page's elements?  Check out this sweet JavaScript snippet:

This is a really neat optical effect, though not the most practical of snippets.

YOLO!

Since `sudo` gives you the ultimate of powers, why not give it a YOLO alias?

Hilarious!

Thank you to everyone who participated, and keep your tiny snippets for the next Tweet for Code!

Recent Features

  • By
    From Webcam to Animated GIF: the Secret Behind chat.meatspac.es!

    My team mate Edna Piranha is not only an awesome hacker; she's also a fantastic philosopher! Communication and online interactions is a subject that has kept her mind busy for a long time, and it has also resulted in a bunch of interesting experimental projects...

  • By
    An Interview with Eric Meyer

    Your early CSS books were instrumental in pushing my love for front end technologies. What was it about CSS that you fell in love with and drove you to write about it? At first blush, it was the simplicity of it as compared to the table-and-spacer...

Incredible Demos

  • By
    Fade Images with MooTools LazyLoad

    I recently received an email from a MooTools developer asking a great question about my LazyLoad class: "I'm using your LazyLoad MooTools plugin (which is great, by the way). I have been trying to figure out how to modify it so that once an image scrolls into...

  • By
    Degradable SELECT onChange

    Whenever I go to Google Analytics I notice a slight flicker in the dropdown list area. I see a button appear for the shortest amount of time and the poof! Gone. What that tells me is that Google is making their site function...

Discussion

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