I have recently changed payment service provider to Braintree on Shelly Cloud and would love to share the experience with you. This post will show a fast and easy way of adding credit card payments to a Rails application.
I would like to share with you the details of how we built Shelly Cloud, our platform for hosting Ruby applications, and how it works.
This is the first post of the series on our blog, in which I'll present you with an introduction to the company and an overview of our stack.
Chef is a framework written in Ruby, and partially in Erlang (Chef Server). It provides an API for numerous system services. With Chef, your infrastructure can be expressed as object-oriented code that is versionable, testable, and repeatable. One of the main ideas of Chef developers was to bury the walls that exist between software development and system administration, allowing them to bring system configuration to a higher level.
Ever run into the situation where you had to perform some operation based on the value from select field? How did you handle it? Maybe multiple case / switch statements? Or if you are lucky enough and code in language with good support for metaprogramming like Ruby you can write some magic code like this one:
which in fact can be treated as hidden case statement, but much easier to handle.
Are there any cleaner solutions to such problems which would be more readable? Fortunately, the answer is yes - some frameworks like Ember give possibility to use cool patterns that are not possible in other cases.
Have you recently got an exception saying
NoMethodError: undefined method `name' for nil:NilClass? Most likely more than once. And how did you solve it? Maybe you used
try and thought the problem is solved... until the same exception happened in a different place! Using methods like
try is just treating symptoms, it doesn't even touch the real problem. Maybe the right question would be: why was it nil in the first place? Could it be avoided? Was the possibility of nil a desired behavior? And why at all is
nil even a problem? Let's find out and investigate some usecases
I've always liked new beginnings, with all the possibilities they bring. And what better way to start fresh with a blog than by writing about one of those first impressions you get when you embark on a new adventure? For me, it was a new job, a new environment, and a completely different approach to work. So, please, fasten your seat-belts and enjoy one of the latest and craziest rides of my life - the introduction to the programming world
tl;dr Collect feedback from your customers; always plan what to do next; think about the user interface before you start writing code; discuss with your team your current work often; test what you have done.
Many developers encounter a variety of difficulties when they have to work on new features. From things like: "how exactly should I start?" to more complex issues, for example, in the middle of a development, they notice that everything they have done is wrong and that it is necessary to start over. Therefore, I have decided to share information about my workflow and how I usually get things done.
Some time ago I heard about Lotus. A fresh Ruby framework for building web applications. It is created from stand-alone parts which are shipped as separated gems. This means that I am able to pick only the essential components for my project. The source code can be found on github.
Regular expressions are widely used in the daily work of developers. For example, I can use the gsub method when I want to replace all the vowels in a given string with the underscore symbol:
"here will be dragons".gsub(/([aeiouy])/, "_") => "h_r_ w_ll b_ dr_g_ns"
The question is how to wrap each matched vowel with the underscore. The first solution is to use the back-reference in a replacement argument:
Not everybody knows that apart from the simplest
console.log() used for logging, the Console object has a couple of other equally useful function. I have chosen and described the 5 most interesting but unpopular methods, which can be successfully utilized in everyday work.