CSS Positioning cheet-sheet. You actually need quite a bit of understanding of CSS to find this useful. I recommend David Sawyer McFarland's book, CSS The Missing Manual.
CSS Positioning
July 19th, 2010New York Tech Meetup July 6, 2010
July 6th, 2010Usual round-up of tonight's NYTM with my brief annotations.
Betterfly.com – A personal betterment site. "Learn look and feel better." Helps independent freelances find clients. Online booking system, availability is displayed and clients can book freelancers online. Nice look site, looks like it could be rails, Web 2.0 polish. Not sure how this site will distinguish itself or if it will gain traction, but it looks nice.
Kill IE 6
June 25th, 2010OK, so I feel it is officially time to kill IE 6 and below. IE 6 has been the bane of web developers' existence for quite some time now. I say, just kill it. If your product manager whines and says "but we need to support all browsers" insist that they reconsider. Management and product managers don't understand the real cost associated with supporting this awful browser. Many think that it's simply a little more tweaking. It's not. If they truly knew how bad it is they'd understand.
New York Tech Meetup June 9th
June 8th, 2010The most dramatic thing at tonight's New York Tech Meetup was, far and away, Scott Heifferman, founder of Meetup.com, smashing an iPad on stage (yes, it was a real iPad). Perhaps the furor over Apple's ubiquitous onslaught of advertising got to him, perhaps it was to be dramatic, probably both. (He was telling us about a new feature on Meetup.com called "Meetups Everywhere" which allows anyone to spark Meetups around a specific topic all over the world.) His move was dramatic, albeit lacking in much of a point (His point was that his innovation is way more cool than the iPad.). http://meetup.com/everywhere
Text overflowing
March 14th, 2010Some experimentation with the text-overflow property.
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<body>
<div style="border: 1px solid red; max-width: 400px; overflow:hidden; text-overflow: ellipsis;">
<nobr>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac libero nec est luctus aliquam. Nulla sodales, dolor a consectetur volutpat, elit mi convallis sem, at ornare ligula odio non metus. </nobr>
</div>
</body>
</html>
Firefox 3.5
Safarai 4
IE 7
Two columns, one stretches with the window the other doesn't
March 2nd, 2010A little CSS pattern to demonstrate what to do when you want one column to stay at a fixed width and the other column to stretch horizontally with the window. Thanks to my friend CSS guru Joe Silvashy for this one.
What I want it a column on my right side to be a fixed width, and the column on the left to stretch with the window gracefully (in web terms this is called a "liquid" layout).
Ruby 1.8.7 patchlevel inconsistency; "super called outside of method"
February 24th, 2010I discovered an interesting difference between two patch levels of the same Ruby (1.8.7)
respond_to do |format|
format.html {
super # call the index method of the superclass
}
end
end
This does not produce an error in Ruby 1.8.7 patchlevel 72 (the one that happens to ship with Snow Leopard), but in Ruby patchlevel 249 (the most recent one), it tells me I'm not allowed to do this.
I want my @current_user in my model: A Lesson in Abstraction
February 18th, 2010This method was adapted from this blog post.
So, you are creating a thing (record) or maybe you are updating it. You've added created_by and updated_by fields to your model, and you've made these integers with the intention of them both being foreign keys to the Users model.
Maybe you've even setup a belongs_to relationsion to your User model like so:
How do I get the HTTP referrer?
February 16th, 2010The referrer is the URL the user came from. (It gets passed as part of the headers to the new request). You can get it out of rails this way:
Or the shorter version:
It seems that no one noticed that "referer" is actually not a word – the correct spelling is double-R ("referrer"). request.referer and request.referrer both work, but request.env['HTTP_REFERRER'] does not.
Public, Private, Protected
February 5th, 2010Quick demonstration of public, private, and protected methods.