1,529 karma · joined December 20, 2011
riding every road at https://wandrer.earth co-founder http://www.concrete-jungle.org co-founder https://www.comingle.io (NSFW)
How is this different from any president filling any vacancy? By nature of the vacancy being filled, a future president won’t be able to fill it.
Bernd is a super fascinating biologist who really dives deep in to things. At one point in the book I think he was talking about chipmunks surviving winter, and it goes really fun on the first principles. Something like: "chipmunks have a surface area of X m^2, and need to maintain an internal temperature of Y˚C. If the outside temperature is -40˚C they therefore they need to consume Z calories per hour just to maintain body temperature. Their favorite food are pine nuts from the white pine tree. The pine nuts each have B calories, so the chipmunk will need to eat D of them per hour. How many nuts can a chipmunk fit in its mouth? Well I found a dead one and shoved pine nuts in to its mouth until I couldn't fit anymore, and managed to get 17 in there. That means..."
This feels like if you were to go after someone advertising themselves as a "Honda repair shop".
The sibling comment of "The WordPress Theme Portal" makes more sense as it might imply "The (Official) WordPress Theme Portal"
So if you had a model Activity, and you wanted to get the names of some of them, the slower/higher memory approach would be something like:
Activity.where("id < 100").map(&:name)
This pulls results from the database, instantiates each as Activity objects, then iterates through each to get its name. You can see in the logs that it grabs the entire object:
Activity Load (133.7ms) SELECT "activities".* FROM "activities" WHERE (id < 100)
.pluck instead grabs just the field you're looking for without instantiating the entire object. So the better way to grab the list of activity names would be like:
Activity.where("id < 100").pluck(:name)
And you can see from the logs that it makes a more narrow query:
(3.8ms) SELECT "activities"."name" FROM "activities" WHERE (id < 100)