March 2012
32 posts
2 tags
February 2012
49 posts
4 tags
3 tags
7 tags
G. Ruby: Mocking HTTP Response body
I’m sure there are many ways to do this — probably better ways — but this is a simple way I’ve done it.
class FakeResponse
attr :body
def initialize body
@body = body
end
end
describe Foo" do
before(:each) do
@data = File.read "./http/response/body.txt"
Net::HTTP.stub!(:post_form).and_return(FakeResponse.new @data)
end
it "should return stuff" do
...
2 tags
6 tags
F2. Proud Papa...
I totally just caught Thing 1 (almost 4) speaking Huttese while watching Return of the Jedi.
4 tags
F2. Pro-Parenting Tip
Have your kid(s) get their PJs on 30 minutes to an hour before bed time when their motivated to do so quickly by something that want to do, as opposed to motivated to do so slowly at the prospect of going to bed.
I’m sharing this, as it took me way too long to learn it on my own. :P
4 tags
G. Bash: past dates in epoch format
Here are some notes on converting dates to epoch and tweaking what dates are displayed. For the purpose of this, I’m trying to pass start and end dates in epoch format to a REST API. I’m looking for ranges which include: yesterday, last 7 days, last 14 days and last 31 days.
Start Time
Note: I set this up so that by changing the DAYS_AGO, you can control how far back in time you...
4 tags
G. Ruby: sourcing and setting environment varibles
I was looking for a simple way to source and set a bash environment variable from a file, in this specific instance, I can’t be 100% sure that the any steps I take to ensure that the file itself is sourced on the host before Rails is started, nor can I impact the format of the file itself (e.g. changing it to YAML).
Here are the best options I’ve found.
File.readline
This is not...
3 tags
2 tags
G. On Set: Empire Strikes Back →
Sweeeeet!
F2. Hey Father...
Thing 1: Hey, father?
Me: Yes, daughter?
Thing 1: When is Mother going to be home?
We're been working on manners, but I have no idea where that came from?!?!
2 tags
F2. Super Simple Solo Dad Dinner
Buitoni Three Cheese Tortellini
Spaghetti sauce
Frozen meatballs
Cook all three per package instructions. Pour sauce over pasta, with meatballs on top.
For fun, melt motzerlla over toast for a cheesy bread side.
4 tags
G. iPhone App Store Filter
Is it just me, or would it be nice to be able to filter out Games from the iPhone App Store’s Top 25. I don’t really play games on my phone, nor do I care about them. It’s annoying as hell to have to scroll through pages and pages of games to see what apps people are using and find things that I might find interesting.
Hear that Apple? Give me better filtering for the App...
F2. Why French Parents Are Superior →
While Americans fret over modern parenthood, the French are raising happy, well-behaved children without all the anxiety. Pamela Druckerman on the Gallic secrets for avoiding tantrums, teaching patience and saying ‘non’ with authority.
French Lessons
Children should say hello, goodbye, thank you and please. It helps them to learn that they aren’t the only ones with...
1 tag
H1. V-day
This February 14 of 2012 had all the makings of a shitty day. Death in the family, spat with my wife, standard exhaustion level that come with have two little ones.
That said, thanks to my wonderful, amazing and unbelievably beautiful wife, it was truly wonderful.
No doubt, I married up and am a lucky man.
Nick Wynja: Ikea Hack Standing Desk →
While I don’t personally use, need or want a standup desk, this is pretty cool for those of you that do…
nickwynja:
When we moved into a new office this past summer, I had a chance to Ikea hack the perfect standing desk. I’ve been using this set up for about 6 months and it’s been ergonomically sound and I’m quite happy with it. I’m taller than most people at 6’ 5” so it was a bit...
RIP Captain Jack D. Stanard USN(Ret.)
To quote my cousin, Jason Stanard, “My family lost a great man tonight. Captain Jack Stanard passed away at 6:20 this evening. He was a soldier, a father, a grandfather, and a good man. I will dearly miss him.” A true statement couldn’t have been said about my Grandfather, he was a rock in our family, yet soft as a teddy bear with us grandkids when we were young and continued it...
3 tags
1 tag
One for the ladies... →
HTBAD Reblog.
4 tags
H1. Edible Underwear (Safe for Work) →
This made me LOL. Thanks Chai, you sick deviant bastard!
F2. ... best friend ...
Thing 1: Daddy?
Me: Yeah, baby?
Thing 1: I want you to be my best friend.
Me: Baby, you'll always be my best friend.
Thing 1: You'll always be my best friend too.
Pure love.
1 tag
3 tags
F2. Solo night with the kids...
Race home from work, fighting traffic the whole way.
Kiss wife goodbye, wish her a good night at work.
Start solo evening with Thing 1 (3-1/2) and Thing 2 (8 weeks).
Pop Thing 2 in the baby carrier, grab the leash and Thing 1 and head out for a nice long walk, but not too long lest Thing 1 need to pee or want to be carried, or Thing 2 get hungry and start balling.
Pre-heat the oven for...
8 tags
G. So I've deleted RVM...
I’ve been known to say how much I hate RVM. But that’s not 100% true. I hate gemsets, they’re messy, hard to track and easily get lost across rubies. I do like the ruby versioning aspect of RVM.
After attending LA Ruby Conf last week and listening to (and agreeing with) Steven Baker’s rant on how much he hated RVM, I asked him what he does instead. The short version is...
5 tags
G. Ruboto + Ruby + JRuby = Android App →
Interesting for those that don’t like Java (like myself).
1 tag
Oh Big Bang Theory, where have you been all my life.
2 tags
11 tags
G. Do, do not. There is no try.
How many different geeky ways are their to say that?
Ruby:
[ "do", "do not" ].include? "try"
=> false
Ruby:
"do".include? "try" or "do not".include? "try"
=> false
Bash:
$DO || ! $DO; try
-bash: try: command not found
I could probably spend 20-30 and figure out how to do this in PERL, Python, PHP, etc. but I want to see if you all out there have them on...
2 tags
3 tags
1 tag
6 tags
G. #LaRubyConf Points of Interest
Presenter — Steven Baker
Death to Bundler
“I hate Bundler… I use Isolate… You should use Bundler…”
“Bundler sucks ass and you all should use it!”
Isolate
Isolate Blog Post
Isolate on Rails 3 Blog Post
S.O.L.I.D.
Single Responsibility
A class should have a single responsibility.
Open-Closed
Open an object, write it and...
2 tags
Optimizing Stand Up →
A quick daily meeting to check the pulse of your project can be immeasurably helpful to everyone on the team. If you’re not careful, these quick daily meetings can easily turn into long sessions where everyone talks, not much is said, and even less is heard. One of the ways to encourage these meetings to be more efficient is to have them standing up.
4 tags
G. Learning...
At #LaRubyConf in Burbank for Maintainable Rails by http://stevenrbaker.com/.
3 tags
The word “hacker” has an unfairly negative connotation from being portrayed in...
– Mark Zuckerberg