For the clearfix can't you just use `clear:right` or `clear:both`? Also for inline-block you can also use the ie7 hack `display: inline-block;*display: inline;zoom: 1;`. Nice tutorial though.
This comment is tangential on purpose, but if anyone is curious as to _why_ we use the `display: inline-block; *display: inline; zoom: 1` "hack" to support IE7, then I will gladly explain it to you.
First, CSS is cascading, meaning a rule following another rule will override it. Second, attributes with an asterisk prepended to the property name are only picked up by IE7. Finally, in a nutshell, IE7 treats layout differently than other browsers. On IE7, certain elements get layout by default, but other elements can be "given" layout by using certain properties (that we refer to as "hacks") like `zoom: 1`. When an element has layout in IE7, it can be given a display of inline and act like inline-block. This is one of the many reasons why older versions of IE were such headaches for web designers. More info about IE7's hasLayout quirk can be found here[1].
If we apply what is described above into these rules, we get this:
1. display: inline-block is applied to the element.
2. on IE7, display: inline is added to the element.
3. on IE7, zoom: 1 gives the element layout, thus making it act like it act like an inline-block. Other browsers attempt to "zoom" the element, but since it's at "1", this is like saying "zoom the element 1x the size," so it does nothing.
> For the clearfix can't you just use `clear:right` or `clear:both`?
Not if you use it on the container itself, since it would apply to the interaction with floated elements that come before the one you use clear on - but here you open the container tag first, and then come the floats.
You could use clear on an element that comes after the floated elements, but before the container is closed, though. (you can also use the ::after pseudo element for this, maybe even in combination with ::last-child or something)
There is a comment on my blog from a developer from MLB.com for anyone who is interested:
"Hi -
Engineer from mlb.com here. It appears this goes a bit deeper down the rabbit hole than meets the eye. Apparently there’s some code laying around in our tests run by a CI setup that randomly generates a tracking code to mock third party scripts (Google analytics, ad tracking, etc) instead of using our actual IDs as to not mess with our marketing guys’ numbers (we run a LOT of tests on CI).
The strange thing is that your IDs aren’t being pulled from your site, but have randomly been generated the same way many, many times and then been shipped out to our production server by mistake.
We can’t figure out why this is happening, but are looking into the build system and how it caches data. Luckily I read HN or we might have never caught this!"
cough bullshit cough, The statically probability that you would generate an actual AND proper tracking code that also just happens to be used by a site that shares all you code is less than can be described. Your team got caught outsourcing jobs to code copy/paste firms.
"Wow, what a coincidence... we just happened to randomly generate a google analytics ID that was the exact same as the one used on a scratchpad plugin that we copied the code from..."
I don't see any reason for the guy to lie. He could just have not responded, or quietly changed the code, but he came to the blog and posted a publicly viewable comment about it ... maybe his diagnosis is wrong and something different is happening, but I'm very willing to believe it was an honest mistake given the circumstances.
I don't think he's lying, but I do think he's mistaken. They probably do generate random codes, but this was not one of them. It looks/smells like a copy/paste.
That aside, though, why not just create a different Google Analytics account and use that one consistently for testing?
This is exactly the reason they responded. By changing the code quietly, they would implicate themselves. An official PR statement like this is obligatory.
What is more probable, that they a lying, or that the random generator generated not a single code that matched, which is very(!) improbable by itself, but two codes that belong to the same account, generated at the same iteration.
This is not an official PR statement, it's an engineer responding at 11 PM (MLB is based on the east coast) with the information he/she had available. I don't think there's an intent to decieve here, just a mistaken guess of the probabilities involved. Hanlon's razor applies.
The thing that most inclines me to believe it is that, by my reading of the article (which admittedly might be reading to much into it), only a subset of MLB pages are using the ID. Hard to imagine why that would be the case if someone was simply copying code wholesale from the "victim" site.
Well mystery solved. I did a bit of sleuthing and noticed they have a scratch card at the bottom of the page. I had written a scratchpad plugin so I did a quick search for "wScratchPad" and sure enough it's there. They copied my sample code from http://wscratchpad.websanova.com, div's css and all and, you can even see the same `id` and `class` names.
Parent comment should be at the top of this submission. The response from MLB about "our CI creating randomly generated GA codes" is kind of ridiculous, when the truth is someone there did an excessive cut and paste from someone else's JS.
He did not release the Analytics code as part of the plugin, it was only placed on his demo site. MLB.com copied code from the demo site instead of downloading the plugin itself.
Actually it's so you can track multiple domain with one code. I do this with subdomains so that I can see all my traffic as well as by individual subdomain.
Well actually it's two sets of codes I use which is custom script I put together to track two ids since I have a lot of subdomains. Not how Google gives it to you, which leads me to believe it was copy and pasted. Still not sure how that could happen though.
Well it's not THAT much of a spike, at least not so far. Although the number has increased significantly since the screen shot. Right now I'm just curious to see how long it will take them to notice.
I'm big on efficiency and DRY methodology both in coding and in processes. I enjoy thinking about solutions on how to make a team work better as much as I enjoy thinking about how to create an elegant solution.
I have lots of experience designing simple interfaces for complicated websites. I also believe in launching code often and breaking a problem down into small parts that can be delivered in days rather than months. There really is no reason why there can't at least be some soft internal or private launch that can get users playing with something.
I would like to work with a company or someone that has interesting problems to solve. I'm at my best when I'm working with people that enjoy discussing and trying to figure out elegant solutions and are self motivated to produce great results.
For any questions or if you would like to chat you can contact me at rob@duchnik.com