So....
I had the problem of getting HTTP and HTTPS traffic to resolve to the same domain with my servers in Googles Cloud. Seems pretty simple at first (or if you use someone like Rackspace), but unfortunately it is not terribly straight forward.
So here is the write up to solve your problem and avoid calling Googles Support line.
1) Create a static IP address but don't assign it to anything.
2) Using the command line tools gcloud, create 2 firewall rules
3) The first firewall rule should be for port 80
4) The second firewall rule should be for port 443
The trick is that when you set up these firewall rules, you need to assign them to the static IP address you created in the first step. Lets pretend you have a new external IP address of 1.2.3.4 You would build your firewall rules like so:
gcloud compute forwarding-rules create rule-name-www --port-range 80 --region us-central1 --target-pool pool-of-vms --address 1.2.3.4
gcloud compute forwarding-rules create rule-name-ssl --port-range 443 --region us-central1 --target-pool pool-of-vms --address 1.2.3.4
And boom! You have it.
I'm sure this could be more robust, but I have more servers to spin up. So off I go. #NeverStopLearning
Wednesday, December 10, 2014
Wednesday, December 3, 2014
Never Stop Learning
Recently I've given a couple talks to students of the Tech Talent South about how I became a Software Engineer. At the end of the talks I often get questions about how they can change their lives to be more focused on developing for the web. Since the answer to that question has changed for me over time I've decided to put down some notes on what I do to stay on top of my game.
- Read Hacker News every day.
- Subscribe to news digests (ex: HTML 5 Weekly, Ruby Weekly)
- Care about what you work on.
- Don't be afraid of new technology.
- Ask other developers to review your code.
- Use Twitter and follow programmers, not celebrities.
As these things come to me I'll update this post accordingly. Thanks for reading and remember....NEVER STOP LEARNING.
Monday, December 1, 2014
Twitter API Requests for Twitter Feeds using JS (client side)
I was trying to build out a tool that would show twitter feeds for a given user. I did the usual and searched google for baked out solutions that I could drop in and tweak as I see fit. That didn't return any immediate results so I dove into playing with codebird.js and found some success, but was still struggling with wrapping my head around the oauth options and what I was able to query.
I had to step away from the computer for a while, but an hour later I returned and went back to the google search to see if I could find someone else who'd had a similar problem. That's when I found Jason Mayes solution (here). It seemed perfect! The reasons he built it were for the same reasons that I went searching for it. AWESOME.
So implemented it and quickly discovered this tool wouldn't be a solution for a business that needs to produce more than a handful of twitter feeds (plenty of people trying to do that here) So after seeing that I'd have to create a widget for each feed I wanted to create and that would most likely have to be done manually I decided that the official API was the best route to go down.
So here is how I did it....
1) Get codebird.js (here)
2) Include it in your HTML
3) Add this JS and replace the needed fields:
Wa-la. I think what I need next is some help blogging. I hope this helps someone who needs a quick fix.
I had to step away from the computer for a while, but an hour later I returned and went back to the google search to see if I could find someone else who'd had a similar problem. That's when I found Jason Mayes solution (here). It seemed perfect! The reasons he built it were for the same reasons that I went searching for it. AWESOME.
So implemented it and quickly discovered this tool wouldn't be a solution for a business that needs to produce more than a handful of twitter feeds (plenty of people trying to do that here) So after seeing that I'd have to create a widget for each feed I wanted to create and that would most likely have to be done manually I decided that the official API was the best route to go down.
So here is how I did it....
1) Get codebird.js (here)
2) Include it in your HTML
3) Add this JS and replace the needed fields:
var cb = new Codebird;
cb.setConsumerKey("key", "secret");
var params = {
screen_name: "username",
count: 20
};
cb.__call(
"statuses_userTimeline",
params,
function (reply) {
console.log(reply);
// Do stuff...
});
Wa-la. I think what I need next is some help blogging. I hope this helps someone who needs a quick fix.
Wednesday, October 2, 2013
Rails 4, Cucumber, Capybara and HTTP Token Authorization
I just watched Ryan Bates excellent Railscast on securing an API with a simple api access_token. That was pretty awesome until I went to implement it and 12 hours later I'm still struggling to figure out how this
authenticate_or_request_with_http_token do |token, options|
ApiKey.exists?(access_token: token)
end
works with Cucumber. There is an awesome gem for helping developers test API's with Cucumber called cucumber-api-steps and it has step definitions for doing HTTP Basic Authorization [link] but does not provide any methods for doing Token based Authorization. This started me down the path of trying to figure out the authenticate_or_request_with_http_token
method. Unless the Token string is formatted correctly, this method will always fail and return a ["HTTP Token: Access denied."]
So before you spend half a day like I did fumbling around with Rack, Cucumber: page.driver.header('Authorization', 'Token token=token_value, option_1=ghi, option_2=qwer')
You can drop that line anywhere in your Cucumber steps and it will set the appropriate headers. I hope this helps someone out there!
Thursday, April 4, 2013
Saving Money One Child At A Time
America is great. You can have children and claim them on your tax forms to receive a tax break. Or you can knock a girl up, have an abortion and deduct the cost of that abortion from your taxable income. At least that's what my latest insurance is telling me:
Ahhh, the silver lining of not wearing a condom and knocking up that blond you met at the bar.
Abortion
You can include in medical expenses the amount you pay for a legal abortion.
You can include in medical expenses the amount you pay for a legal abortion.
Ahhh, the silver lining of not wearing a condom and knocking up that blond you met at the bar.
Friday, February 8, 2013
Burrrrrr
So I just shoveled the walk for the first time in ages. I must say, I honestly enjoyed every minute of it and I can't wait to go back and do it again.
Dad: I am sorry I ever bitched about shoveling the walk.
Thanks to Calvin & Hobbes I have a couple ideas of how I'll keep the shoveling exciting.
When my girls son gets home from school, I'm going to introduce him to a) the comic Calvin and Hobbes and b) making awesome snowmen.
It's amazing how much this comic meant to me as a child. I'm always blown away when people have never heard of it. To me it was a reason to read the newspaper, it was the book I went to when I was bored and it was a blue print for having fun and being mischievous. No homo.
Dad: I am sorry I ever bitched about shoveling the walk.
Thanks to Calvin & Hobbes I have a couple ideas of how I'll keep the shoveling exciting.
When my girls son gets home from school, I'm going to introduce him to a) the comic Calvin and Hobbes and b) making awesome snowmen.
It's amazing how much this comic meant to me as a child. I'm always blown away when people have never heard of it. To me it was a reason to read the newspaper, it was the book I went to when I was bored and it was a blue print for having fun and being mischievous. No homo.
Thursday, January 17, 2013
I Agree
I was listening to NPR the other day and I heard a great conversation between Robert Siegel and a retired Army Maj. Gen. Dean Allen Youngman, executive director of the Defense Small Arms Advisory Council. Going into it I was prepared to hear a right winged loon talk about how Barry-O is trying to steal our guns. When I was finished with the story, my opinion on our governments response to the Sand Hook Elementary School shooting had turned from reasonable to flat out wrong. I don't desire a platform to state my beliefs, but I do think you should give this story a shot. No pun intended.
http://www.npr.org/2013/01/16/169543646/gun-manufacturers-say-assault-weapons-arent-a-high-pay-off-target
In unrelated news I think I broke my toe at ninja college last night. Not to thrilled about that one. Even more unrelated I'm leaving Fairfield County and moving to Rockland County. I was born in Yellowstone County. Some numbers...
I'm heading to Yellowstone County in a week. Taking the girl with me. Pretty jazzed about that.
http://www.npr.org/2013/01/16/169543646/gun-manufacturers-say-assault-weapons-arent-a-high-pay-off-target
In unrelated news I think I broke my toe at ninja college last night. Not to thrilled about that one. Even more unrelated I'm leaving Fairfield County and moving to Rockland County. I was born in Yellowstone County. Some numbers...
Medium Income - Single - Family Fairfield - $65,249 - $77,690 Rockland - $67,971 - $80,235 Yellowstone - $36,727 - $45,277
I'm heading to Yellowstone County in a week. Taking the girl with me. Pretty jazzed about that.
Subscribe to:
Posts (Atom)