Quantcast
Channel: Nifty Snippets
Browsing latest articles
Browse All 37 View Live

jQuery - Element cleanup update

For those who saw my jQuery - Cleaning up when elements go away post yesterday, I've updated it showing how we can do this right now, today, without waiting for the enhancement (or if the enhancement...

View Article



Measuring Scrollbar Size

Normally we want to avoid doing this sort of thing, but sometimes you just end up having no other option: Recently I couldn't avoid doing some sizing logic in JavaScript rather than CSS and markup, and...

View Article

A reminder how Microsoft used to drive web innovation

As IE6 finally rides into the sunset,* Nicholas C. Zakas offers us a reminder of how, in a series of browser releases culminating in IE6, Microsoft introduced many of the key web innovations we use...

View Article

S3 Adds CORS Support

Some interesting news today: Amazon's S3 now supports CORS, the Cross-Origin Resource Sharing standard. This means that in addition to storing your images, stylesheets, and JavaScript files in S3 as...

View Article

Incredible. Extraordinary. Inspiring. Beautiful.

Ten years of Hubble photographs of a tiny portion of the night sky, well away from the glare of the Milky Way, deep into the infrared and then corrected back to visible, the eXtreme Deep Field is...

View Article


Quick note on RegExp#lastIndex

Just a quick note on RegExp#lastIndex: It's misnamed. It's not the "last" index of anything, it's the index of the next character in the string that will be looked at by the regex instance's exec...

View Article

You can contribute to caniuse.com

I'm sure most of us have referred to (and probably cited) caniuse.com at some point. It's probably the most comprehensive collection of browser feature support around. Want to know the status of CORS...

View Article

I Don't Want To Create An Account

Note to online vendors:I don't want to have to create an account to give you business.Got it? By all means offer me the option of doing so, if that makes you happy, but if I'm buying 10 quid of...

View Article


Asynchronicity

I see questions like this one a fair bit: The author has written this code (and is apparently using jQuery):function Obj() { this.id = 0; this.name = ''; } Obj.prototype.setName = function(name) {...

View Article


Blitz.io Updates Pricing Model

Early this month I was checking out blitz.io and although it looked like a cool tool (and fun), the pricing model stopped me looking at it too closely, for reasons I explained to them:Hi folks, Was...

View Article

Font Size Units

I've always used points (pt values) for sizing fonts on web pages, e.g.:body { font-size: 12pt; }Those of you who know me know that I'm a developer, not a designer (in the web designer sense; I design...

View Article

Website Feedback Popups

You want my feedback on your website? Here's my feedback: Website "feedback" popups are irritating and intrusive.

View Article

Amazon S3 Adds Root Domain Support

More interesting news from Amazon: Now S3 supports static website hosting on the root of your domain. So in addition to http://www.example.com you can now have http://example.com. This comes warm on...

View Article


Opera switching to WebKit+V8

Opera has decided to switch to using WebKit and V8 for for all new products. First they'll start with a product for smartphones (since as they say, many mobile-facing sites are only/best tested on...

View Article

Private properties in ES6 -- and ES3, and ES5

JavaScript famously lacks private properties on objects. The next version will have them (more on that below), but we can have most of the benefits of the upcoming improvement right now (without...

View Article


Submitting forms programmatically

Very short one today, folks, because something surprised me: If you use jQuery to submit a form programmatically, it will trigger submit handlers on the form. This surprised me because if you use the...

View Article

Windows Pop-Up Shutdown Script

Sometimes, you want to configure a Windows system so that it shows a message when shutting down. In my case, it's to remind me (because I'm too bone-headed to remember!) to unmount any shares on the...

View Article


Plain JavaScript

"I want to do this with pure JavaScript, not jQuery.""How do I do this with raw JavaScript?""I don't like to use libraries, I like to use vanilla JavaScript." Enough! Using a library like jQuery (or...

View Article

Centering Made Easy

Almost a note-to-self today. :-) Now that IE6 and IE7 are dead unless you need to support users from the far East, centering content within elements using CSS is dead easy. Three simple rules:display:...

View Article

Session tokens, cookies, and local storage

Link-post today, the Meteor blog has a very interesting post about why Meteor has so-far avoided session cookies in favor of localStorage, including a high-level but nevertheless useful overview of...

View Article

Chrome and Java

If you use Chrome and are unfortunate enough to still have to use Java applets from time-to-time, you may recently have been unpleasantly surprised to find that the Java plug-in stopped working (if you...

View Article


VirtualBox -- USB not working

Just a snippet today, as much to remember it as anything else: If you're using VirtualBox on Linux and USB devices aren't working despite the fact you've installed the extension pack, it's because you...

View Article


JavaScript's Date/Time Format Is Not ISO-8601

TL;DR JavaScript's date/time string format isn't ISO-8601. It's much simpler, covers fewer use cases, and assumes strings written without a timezone indicator are in UTC (whereas ISO-8601 assumes...

View Article

Automatic Semicolon Insertion

I've been recommending to people that they not rely on Automatic Semicolon Insertion for years now, and frankly wish that the strict variant had removed it. Just wanted to share the best argument for...

View Article

Common `fetch` errors

The new fetch API is a great improvement on XMLHttpRequest but it does have a very surprising behavior that catches people out a lot. Separately, because it uses promises, a lot of people using it fall...

View Article

Browsing latest articles
Browse All 37 View Live


Latest Images