background preloader

Ruby

Facebook Twitter

Mike Subelsky's Blog: How to setup credit card payments for your web application. Implementing credit card payment systems has been one of my least favorite coding projects, but things have gotten much nicer since I first started.

Mike Subelsky's Blog: How to setup credit card payments for your web application

I'm just starting again with my new company, and I will be continuously updating this post with my progress. I'm hoping to capture every single decision I've made to help other people get going and also as a reference for myself the next time I need to do this. 10/20/11: Choosing a Merchant Account and Gateway After looking at a few different payment gateways, I've decided to try Braintree, mostly because of their awesome-looking, well-documented Ruby gem, but also because I've seen them at various Ruby/Rails events (speaking and sponsoring), and because I've heard good things about them from Figure53 and friends at LivingSocial. I also really like their "transparent redirect" feature, where credit card numbers never enter our system at all. Rails Ecommerce done right. I've been playing around with stripe for the past month and I have been pretty impressed.

Rails Ecommerce done right.

It is so easy to use and the documentation is great. That being said there are downsides to stripe compared to ActiveMerchant. It does not support an authorize / capture workflow.You can only store one credit card per user. When you first start using Stripe it appears the authorize / capture workflow will work just fine. If the customer enters their Credit Card every time, this is the case. Once you store the customer's Credit Card the authorize/capture workflow no longer works. My issue also had to do with accounting.

Also only being allowed to store one Credit Card is a bit of an issue. That being said Stripe has been amazingly easy to setup. Alex Rothenberg - Programming With Kids. I’ve started to teach my kids to program.

Alex Rothenberg - Programming With Kids

I figured I build websites professionally and it’d be a fun way for me to share what I do and help supplement their learning. And it was something they expressed interest in not something I was pushing. I suggested we build our own small version of facebook or twitter. Using Redis as a temporary cache for data shared by multiple independent processes. There are times, when you need to share some data between multiple processes, one of the ways is to use Redis.

Using Redis as a temporary cache for data shared by multiple independent processes

Not so long ago I’ve been working with an application which performs some types of calculations based on a crawled websites. Crawler pulls URLs from a page and sends them to a RabbitMQ. Then a worker is fetching those URLs and ignites multiply calculating processes (each of them is independent from the others – they just use the same dataset). They should use same dataset but to be honest… they didn’t. Each process has been downloading same website over and over again, so instead of a page been downloaded one time – it has been downloaded minimum N times (N is a number of processes working with that page). Below you can see how it was working before optimization: And how it should work: As you can see above, there is one method which communicates with Redis.

Tutorial and Example App for Rails with Subdomains. How to Make Gem Patches with Gem Edit. Here at RANDOMTYPE we use gollum as an internal wiki for keeping track of important things like server setup steps, solutions to problems we’ve solved, unix tips and tricks we’ve found, and the like. So when I got this friendly error from gollum I was a bit concerned: The full stack trace was big and ugly: Grit::GitRuby::Internal::LooseObjectError - size mismatch: /.rbenv/lib/ruby/gems/1.9.1/gems/grit-2.4.1/lib/grit/git-ruby/internal/loose.rb:59: in `get_raw_object' Pakyow: Punch Packing Web Framework for Ruby.

Twitter Bootstrap on Rails. In the past weeks I saw a lot of interest for the twitter bootstrap framework, and for good reasons.

Twitter Bootstrap on Rails

Cut and Polish: A Guide to Crafting Gems : Freelancing Gods. As I mentioned here earlier in the year, a few weeks ago I had the pleasure of visiting Ukraine and speaking at the RubyC conference in Kyiv.

Cut and Polish: A Guide to Crafting Gems : Freelancing Gods

My talk was a run through of how to build gems, some of the tools that can help, and a few best practices. The video of my session is now online, if you’re interested: There’s also the slides with notes, if you prefer that. One of the questions asked towards the end was about publishing private gems, which I’d not dealt with before. However, Darcy was quick to tweet that Gemfury looks like a promising solution for those scenarios. Please let me know if you think I’ve missed any critical elements of building and publishing gems – or if you have any further questions. Rails Benchmarking Reloaded. Boston Ruby Group. Boston Ruby Group. Ruby Blocks as Dynamic Callbacks. Callbacks are a great technique for achieving simplicity and flexibility.

Ruby Blocks as Dynamic Callbacks

Simply put, a callback is a block of code passed as an argument to a method. In Ruby, code blocks are everywhere and Ruby makes it trivial to pass a block of code to methods. For example: def foo(bar, &block) callback = block callback.call(bar)end foo(5) {|x| x * x} # => 25 But what do we do when a method needs two blocks of code or more? Two ways of using Redis to build a NoSQL autocomplete search index. Last week I demonstrated how to setup autocomplete in a new Rails 3.1 app using the Soulmate gem, from SeatGeek.

Two ways of using Redis to build a NoSQL autocomplete search index

Soulmate uses Redis to cache all of the autocomplete phrases in memory, providing lightning fast query results. While autocomplete is a very useful feature and a common web site design element, what really interests me about Soulmate are the ideas and detailed techniques behind how it uses a NoSQL Redis database to implement autocomplete search. Finding your soulmate: autocomplete with Redis in Rails 3.1. Back in February the SeatGeek team open sourced a gem they call Soulmate that implements autocomplete using a Redis back end.

Finding your soulmate: autocomplete with Redis in Rails 3.1

“Soulmate finishes your sentences” as they say on their Github readme page. You can see it in action on SeatGeek.com. Soulmate is very useful: many of us need type ahead search behavior and using Redis is a great way to make it fast and snappy. But more importantly, Soulmate is a great example of how to create an index in Redis ahead of time, allowing for very fast lookups later.