April 2008
41 posts
A PHP FYI
empty($object->name) doesn’t actually work. The expected behavior would be to return TRUE if $obj->name is empty. Instead, it just returns TRUE. All the time.
If you want to test the existence of an instance variable, you’ll have to use !($object->name)
If I had a nickel…
…for every time in the past week that I tried to create an array in PHP using ['bracket', 'syntax'], I’d be…able to buy a slice of pizza or something.
The problem with feeling you’re doomed is not just that it makes you...
– Be Good
A wonderful article by Paul Graham. I think in particular this quote applies not just to startups writing code but anyone developing any product. It is amazing how much of a correlation there is between how happy you are working on a project and how much you get done. Being happy == being...
NYC Apartment Hunting
So it looks like I’m going to be moving to NYC after graduation. Anyone have any suggestions for the best way to go about finding an apartment?
def sanitize_sql_array(ary)
statement, *values = ary
...
end
This is...
– Ruby Pearls vol. 1 - The Splat
I saw this head & tail thing in Erlang a while ago & have been wondering if there was a nice way to replicate it in Ruby. Brilliant!
Python vs. Ruby
Given a collection of objects, we want to filter the list based on some property then grab a collection of the value of a different property for each object.
Python:
def average(lisp):
return sum(lisp) / float(len(lisp))
average([obj.other\_property for obj in [obj for obj in collection if obj.property == some_value]])
Ruby:
class Array
def average
inject(&:+) / size.to_f
...
Ten typographic mistakes everyone makes →
Grammar nazis are so last century. Welcome, friends, to the brave new world of the typography nazi.
(via jhongosh)
Milliways: The Restaurant at the End of the... →
Unreleased sequel to the original HHGTTG text adventure.
stereotypical tumblr user checklist
I, dstrelau…
use a mac: Core 2 Duo Macbook (white!)
are twenty something: Yes, indeed!
take polaroids: Digital polaroids?
live in nyc: Maybe soon!
wish you lived in nyc: Yeah…
draw sometimes: Rarely.
upload videos to vimeo to fit in: Not really. I’m more the photo/text kinda guy.
have a muxtape: Not yet. Soon!
work for collegehumor/vimeo/bustedtees: Nope
are a...
Here’s a tip for keeping up to date: In lieu of using git pull to download...
– Best Practices for Contributing to Rails with Git
Really, good info for contributing to any project with Git.
Time Management →
So the rule is…
Use flash when you’re going to redirect, so that the next...
– All the kings horses
open break-up letter to rails
→
really need to get on this merb thing
Git much?
[~] history|awk '{print $2}'|sort|uniq -c|sort -rn|head
102 git
72 gt (alias for git status)
59 go (alias for git checkout)
36 cd
29 gb (alias for git branch)
23 ls
19 mate
19 gd (alias for git diff)
17 ga (alias for git add)
13 mysql
The value of immutable values →
Polymorphism is always the wrong term →
Particularly good writing is probably going to boost your grade even if your...
– An email from a teaching assistant for my 300-level class at Cornell University.
I’d say that good writing should be the standard and that poor writing should bring your grade down. I suppose I just expect people to know how to write by the time they get to university…
The Rather Difficult Font Game →
I scored an embarrassing 23/34…
(via DF)
Magic Eye Through Text →
(via featureorbug)
To: Anyone Who Imports Their Top 5 Artists From...
Please stop.
Cheap Rails VPS options →
I’ve had a Slice for a year now and have been really happy with it!
Rails on GitHub →
Hooray!
create_table :taggings do |t|
t.references :tag
t.references :tagger,...
– Changeset 7973 - Rails Trac
I had no idea you could do that!
The Thing About Git →
Great description of why the Git staging area is awesome (not evil) and how to take advantage of the power of git add --patch
So the only thing that really teaches you to fucking ship is, well, fucking...
– Amy Hoy’s Just ship. Seriously.
Renderance →
On web typography
alias bashrc='vi ~/.bashrc && source ~/.bashrc'
Now you can type...
– ozmm
Brilliant! Now just make that mate instead and we’ve got a real winner!