Dropbox please add a goddamn delete button

Yesterday my mum asked for my help regarding “something was changed in Dropbox and I can’t delete my photos”. You see my mum and my dad are over their 60s and didn’t grow up with computers. And that makes a huge difference. They don’t really understand what a folder is and what is its relation related to other folders (the filesystem structure, that is), they haven’t linked the notion of common UI elements (like a checkbox) with their actual function. They just memorize things, and rarely do they...

REST is all about evolvability

I just saw this post (RESTful APIs, the big lie) and I am wondering if developers understand what REST is before denouncing it. Even worse, people are agreeing in that post’s comments and if you go to hackernews or reddit discussion about this blog post you will see that most people are confused on what REST is, which sometimes wrongly leads to the assumption that REST is bad.

REST is all about evolvability by applying a uniform interface in your implementation.

If you do have evolvability in...

We need better compartmentalization

With the latest updates from the unethical moves of Kite, something that I had been thinking about for a long time now came into my mind again: how secure is our Ruby/Rails/Sinatra/Hanami code?

We have been using so many little gems to save time from re-inventing the wheel and that has worked out great. We save time by reusing open-source projects, let alone all the advantages of using open source in our code. But if we step back and take a look from a security perspective, adding gems even for...

Roy's REST thesis extracts

I have been studying REST (along with HTTP and other RFCs) extensively the past months and I liked the following quotes. Basically, REST is the only model that solves the evolvability of an API without breaking the clients.

REST, a novel architectural style for distributed hypermedia systems;

An architectural style is a coordinated set of architectural constraints that restricts the roles/features of architectural elements and the allowed relationships among those elements within any architecture...

My favorite RSpec aliases

Development in compilers has advanced so much that static typed languages have reached the same level human-friendly level as dynamic languages and type safety is coming back while dynamic languages are fading away :)

Lately I have been focusing more on safety when I develop code on dynamic languages, especially in Ruby. (I had a couple of days fun in Crystal and it feels like a minefield when working with Ruby again or any other dynamic language)

One of the usual things I do is, in order to...

Best service objects until now

Service objects was a big thing a couple years ago in Rails community, like everyone just learned about the single responsibility principle. In any case, personally I couldn’t find a Service Object pattern that I was happy with, neither from my brain nor from the Internetzz. Lately I have been using something that I can say it’s good enough. I call it PerformerService, meaning that it’s for service objects that should have a simple method, called perform. First I define and include the following...

Creating methods dynamically in a Ruby object

It feels like Rails’ makes things hard when working with models that are not AR-related, which sees to be the case lately as we are integrating more and more external services.

Sometimes you have a class, say User, that defines some methods like first_name, last_name etc. and you use an object of that class in forms in your Rails app.

Now imagine that in a specific form you also need to render a couple more inputs, related to the user object BUT you don’t want to define those methods in your...

With pattern in Ruby

I have been using lately this nitty gritty pattern mostly inspired by Ember’s with template helper. If you have an object (usually in your .erb template) which has a long diameter it becomes a bit problematic when you have to repeat it again and again.

For instance (imagine these in one line with some HTML):

<%= @presenter.unit.department.name %>
<%= @presenter.unit.department.year %>
<%= @presenter.unit.department.faculty.count %>

What you can do is to assign a variable in the template and...

Env variables inside Ember's index.html

Using environment variables in ember is straightforward: export your env vars using any tool like direnv and import them inside your config/environment.js using node’s process.ENV.YOUR_ENV_KEY.

  ENV.APP.MIXPANEL_TOKEN = process.env.MIXPANEL_TOKEN;
  ENV.APP.GA_TOKEN = process.env.GA_TOKEN;

Then in any part of your Ember app you can import the config env and use them.

import Config from 'my-ember-project/config/environment';

However this won’t work if you want to use an environment variable...

An alternative to eval

When we define a closure in Ruby (a proc or a lambda), it encapsulates its lexical scope/environment.

This means that even if you define a proc in point A in code, if you pass it around and call it in point B, it will still be able to reference variables and anything that is defined inside the lexical scope of point A (where it was defined). To put it in another way, it has “(en)closed its environment”.

What if we would like to do the opposite. Say we define a proc in point A, that if we call...


Page 1 of 2 older posts →