20over20
20over20
20 Over 20
49 posts
Overwritten manually in the HTML. Look for id="about"
Don't wanna be here? Send us removal request.
20over20 · 12 years ago
Quote
So then, let's suppose you were able, every night, to dream any dream you wanted to dream. And that you could, for example, have the power within one night to dream 75 years of time. Or any length of time you wanted to have. And you would, naturally, as you began on this adventure of dreams you would fulfill all your wishes. You would have every kind of pleasure you could conceive. And after several nights of 75 years of total pleasure each, you would say, "Well that was pretty great. But now let's, um, have a surprise. Let's have a dream that isn't under control. Where something is gonna happen to me where I don't know what's it's gonna be." And you would dig that. And come out of that and say, "Well that was a close shave, wasn't it." And then you would get more and more adventurous. And you would make further and further out gambles about what you would dream. And finally, you would dream, where you are now. You would dream the dream of living the life that you are actually living today.
Alan Watts: The Dream of Life
0 notes
20over20 · 13 years ago
Link
Model files can get pretty big with a lot of stuff going on. We've standardized on an organized layout amongst all our projects to keep things clean and consistent. We keep this layout as a template file in our models directory that we use for creating new models. I've shared this template file as a Gist in case others find it useful as a starting place for their next model. https://gist.github.com/4241250
0 notes
20over20 · 13 years ago
Text
Rails Mailer's Subject Inference
Turns out you can leave out the :subject key when sending mail in Rails 3, so long as you have the proper keys / translation in your en.yml (or other language files):
Notifications < ActionMailer::Base; def new_user( user ); mail :to => user.email; end
Will map to:
en: notifications: new_referral: subject: "Welcome to the app!"
0 notes
20over20 · 13 years ago
Quote
Failure is the opportunity to begin again more intelligently.
Henry Ford
0 notes
20over20 · 13 years ago
Link
0 notes
20over20 · 13 years ago
Quote
Thanks for being here. Let’s make great things.
A quote from the Preface of Valve Software's New Employee Handbook. EVERY COMPANY SHOULD BE RUN LIKE THIS. The full handbook can (and should) be read here: http://newcdn.flamehaus.com/Valve_Handbook_LowRes.pdf
0 notes
20over20 · 13 years ago
Text
CharlesBergeron.ca
I decided to bite the bullet, and finally build a portfolio site for myself. I had always had one for my past company, Carbon Media Design. But now here's my chance to toot my own horn. http://charlesbergeron.ca
0 notes
20over20 · 13 years ago
Link
The site is ugly as sin, but the message rings clear.
0 notes
20over20 · 13 years ago
Text
Rdio Missing Some of Your Favourite Albums?
I'll admit it, I'm a bit of an Rdio addict. Sometimes tunes are either missing or they disappear over time. If you find this happening, fill out this super terrific help form. And yes, it works. I managed to coax Rdio staff to recover all the Four Tet albums that went astray.
0 notes
20over20 · 13 years ago
Text
Getting the end of the month with Ruby
It's as simple as specifying a negative one for the month value.
Date.new(2012, 2, -1)
Awesome to avoid manually trying to calculate the end of the month.
0 notes
20over20 · 13 years ago
Text
You have to use `get(0)` to compare equality of jQuery objects.
This stumped me for a little while because it's not intuitive. *In CoffeeScript.* ### Wrong
$previous_link.hide if $previous_link isnt $(this)
### Right
$previous_link.hide if $previous_link.get(0) isnt $(this).get(0)
OR
$previous_link.hide if $previous_link[0] isnt $(this)[0]
OR *( Just updated this thanks to [Eric](https://twitter.com/#!/theericanderson)'s input. )*
$previous_link.hide unless $previous_link.is( $(this) )
4 notes · View notes
20over20 · 13 years ago
Text
Removing leading zeros with strftime in Ruby
I had no idea you could do this, so I figured I'd share it. You can remove leading zeros when formatting datetimes with strftime() simply by putting a dash / subtraction sign in front of the format specifier. For example:
Date.parse("June 7th 2012").strftime("%A %B %-d %Y")
produces:
"Thursday June 7 2012"
You can do the same thing with leading zeros in time format specifiers as well. It all depends on your version of strftime you have installed though, so I would run some code and see if your current version is capable of it.
0 notes
20over20 · 13 years ago
Text
Gotcha: Rails after_validation is ALWAYS called, even if the model validation fails
You may be tempted to think that after_validation model callbacks are called only if validation passes, however, it always gets called, regardless of whether the model passes validation or not. If you want to ensure that your callback method's code is only called if the model is valid, you need to check manually. That said, DO NOT use self.valid? as it will begin an infinite loop.
1 note · View note
20over20 · 13 years ago
Link
It's amazingly difficult to find this. There is out-dated documentation floating around and a fork from CollectiveIdea that you'll first wind up at. This is the official repo of the Ruby Money gem.
2 notes · View notes
20over20 · 13 years ago
Text
Edit This Rails
This is the bash alias Josh mentioned in his blog post last week about Textmate hanging.
alias etr="mate app config config.ru db Gemfile* lib Rakefile README test vendor/assets"
"etr" stands for "Edit This (Directory) Rails", and it'll open Textmate with only the specific directories you want in your project sidebar. Swap mate with "subl" for Sublime, or whatever your editor of choice is.
Note: Looks like I picked it up from Peepcode years ago. Here's a slew of useful aliases found on Github (pick and choose with a grain of salt):  https://github.com/jjb/dotfiles/blob/master/common/aliases
0 notes
20over20 · 13 years ago
Text
Can't Use "no" as a Key for I18n in Rails.
# No worky en: no: clients: You are not associated with any clients. # Works en: empty: clients: You are not associated with any clients.
Looks to be a special word for I18n. Not sure if it's Rails-specific or I18n altogether or why it's a special word. My best guess is that it's tied to boolean translations so true can be yes/no or oui/non, etc.
11 notes · View notes
20over20 · 13 years ago
Text
Adding SASS, SCSS and CoffeeScript Files to AckMate.
### Precursor [AckMate](https://github.com/protocool/AckMate) is a [TextMate](http://macromates.com/) plugin based on [Ack](http://betterthangrep.com/) that provides a **much** faster *"Search in project..."* function. If you've ever been bored looking at the beach ball when using the search built-in with TextMate, you should go grab it. However, AckMate (or more precisely, Ack) doesn't know about our new filetypes, like [SASS](http://sass-lang.com/), [SCSS](http://sass-lang.com/) and [CoffeeScript](http://coffeescript.org/). But it's painless to let Ack know that you're working with these files and to include them in its searches. Here's how. ### Adding Custom Filetypes to AckMate 1) Create a file called .ackrc in your home directory:
$ mate ~/.ackrc
2) Add the following lines to .ackrc:
--type-add=scss=.scss --type-add=sass=.sass --type-add=coffeescript=.coffee
3) Restart TextMate and away you go. ### Resources https://github.com/protocool/AckMate/wiki
4 notes · View notes