Michael de Silva's Blog

Software Engineer. Rubyist and Roboticist.

Michael de Silva's Blog

Software Engineer. Rubyist and Roboticist.

Got an app in mind?

Since 2010, I have crafted apps for mobile and web for clients around the world via my consultancy — Inertialbox. My specialities include Rails, client-side Javascript frameworks such as Backbone & Ember.js, TDD/BDD, and DevOps — just to name a few.

We should talk.

How To Set Up A Slack Channel As An AWS SNS Subscriber

I wanted to receive error notification when my ec2 instances CloudWatch metric passes a set threshold and as such was looking for a means to get notification sent to Slack, as a means to avoid the general noise in email notifications.

To this end I discovered "How To Set Up A Slack Channel To Be An AWS SNS Subscriber" which is easily adaptable via SNS itself.

Having tested the Node Lambda function, don't forget to ensure that you subscribe the Lambda function to the SNS topic. When done correctly, within AWS' console > SNS > Subscriptions you should see details of the lambda function specified with a Subscription ID and protocol as lambda.

Recover Hidden Files and Folders with TIme Machine in Mac OS X

Having inadvertently run rm -rf ~/.foo whilst connected in via my laptop, I needed to restore that folder back via Time Machine.

Here are the steps I took to get it back,

  1. Renamed the folder as mv ~/.foo ~/_foo so that it is no longer hidden, and I can delete it manually — this was only needed as some files within this folder were being accessed by my irssi client at the time; so you may not have to do this.

  2. Run defaults write com.apple.finder AppleShowAllFiles YES and killall Finder.

  3. Run Time Machine, pick the folder you want to replace. BOOM!

  4. Run defaults write com.apple.finder AppleShowAllFiles NO and killall Finder.

Note: Notice that finder is explicitly Finder in the commands above!

Easy peasy.

ECMAScript6 Compatible Yeoman Foundation SASS Generator with Browserify & BrowserSync Live Reloading & CSS DOM Injection

Screen shot 2016 01 17 at 22.19.11

At the time of writing, I had stumbled onto the foundation-gulp-browserify Yeoman generator and within a couple hours I had a really slick static page live & hosted on AWS S3.

However, I noticed this generator, like most of the Yeoman generators, has gotten old and doesn't seem to be actively maintained any more.

It has 19 Github stars and the last commit was on 1st December 2015. Interestingly, the last commit reads

reverted to foundation 5.5.2. Foundation scss folder structure has changed and will require more reworking than I initially thought

Having used Gulp before, I really liked how it got the job done; dependencies were fixed with a simple npm install, but what really sold me were two things.

BrowserSync

If you've tried to get pixel-perfection in responsive designs without BrowserSync you will understand the level of frustra ...(continued)

Reflecting on 2015

This past year has been incredible, and it is one for which I am very grateful.

I spent most of the year working on Crestwood.co.uk, which was rather challenging at first. My work involved re-writing a legacy Rails 2x CMS in Rails 4, and carrying over a lot of legacy functionality, including interfacing with a SOAP based warehousing system (Opera).

The 'feed' aspect was originally rather straightforward, but this was highly complicated by a decision that greatly impacted the project — a decision that was completely out of my hands. It even had me reading up mathematical papers from 1970's by Dijkstra, where I implemented a rudimentary shortest-path tree-searching algorithm in Ruby.

Towards the end of the year, I parted ways with my client based in the UK (which has incidentally been liquidated since the company was driven into the ground!), and since then have joined a fabulous team based in Canada. From Monday, I will be ...(continued)

Merry Christmas & Happy New Year for 2016

464 10102288701607409 5880169243550324460 n

Wish you and yours a very Happy New Year!

Designing the Inertial Box Logo, by Grilled Pixels

Inertialbox logo sample

I woke up today to the fantastic write up by Sacha Greif What Kind of Logo Do You Get for $5?, an epic tale of deception, stolen artwork, and crappy logos, which is a condensed version/follow-up of "The $5 Logo."

There was a time, when I too was shopping for something on a tight budget — and in all honesty, I probably would have been better off making my own logo; however, I was up to my eye-balls in client work and simply was unable to make time. It's just $5, right?

Wrong. I fell for the $200/- option where you get "everything", including all the stationary. Sounds amazing! Of course, that was the only option that also provided source Illustrator *.ai files. Blurry PNG/JPGs wasn't going to cut it.

I spent a lot of time giving the designer a long background on what ...(continued)

HOWTO: Setting up HTTPS (SSL/TLS) with Nginx & Rails

Screen shot 2015 09 23 at 22.54.02

In this article, I dive into the intricacies of creating a self-signed SSL certificate for local development & testing, working with CA-bundles (intermediate certificates) when purchasing your production SSL certificate, and how to configure Nginx so that its SSL options are configured for improved security (and performance).

I also provide an Nginx configuration that I am currently using in production for a client's eCommerce application.

Creating a self-signed Certificate

The following is a summary of the steps detailed in the Heroku Devcenter. I will first go over this step-by-step and then show you how it could be done as a one-liner.

Generate private key

A private key and certificate signing request are required to create an SSL certificate.

Start by creating the private server key. During this process, you are normally asked to enter a specific passphrase, which we have skipped ...(continued)

Tumi's ID LOCK Technology, just another Faraday cage. For your wallet.

552a8a0393ad1.jpg e600

Here's an interesting twist on protecting your cards that have RFID chips for NFC. Tumi are promoting what they call 'ID Lock'.

This item offers added security with protection against identity theft. It features an exclusive and patent pending technology that shields your personal information encoded on credit cards, passports and other forms of identification from would-be thieves using invasive communication and electronic data reading devices.

Basically metal threads that work to act as a Faraday cage. That's pretty neat.

Rails Master Class: Effectively Using ActiveRecord Callbacks

When it comes to ORM's, ActiveRecord is personal favourite of mine especially considering features such as AREL an AR Callbacks. In solving challenges, there's always multiple ways of skinning a cat, and here I will show you some interesting issues I've tackled today — and how I approached this from a troubleshooting aspect, and the steps I took literally in my head.

Come on Short Round, join me on a riveting adventure!

With great responsibility, comes great use of the around filter

Today I was troubleshooting an issue seen on a client's staging server, which pulls in Agents over an API. One particular issue was that emails were being sent out with invalid login credentials, when I was pretty sure those records were being persisted — even though I did not write the original implementation of this feature.

      before_validation :generate_password

      def generate_password
        if self.password.nil?
          self.password = ...(continued)

HOWTO: Chosen.js for Multiple Select fields with Search in Autoglym Professional

Screen shot 2015 08 19 at 17.36.57

I didn't have much time to build this feature, and hit the interweb for multi-select options and stumbled on the fantastic Chosen.js. Since I was working on Rails 3.2.x app at the time, I went with https://rails-assets.org/

source 'https://rails-assets.org' do
  gem 'rails-assets-chosen'
end

...and simply loaded chosen into the JS and CSS Sprockets manifests.

Since I was in a hurry, I kept things simple, and my JS looked like

    $('.chosen-select').chosen({});
    $('.chosen-select').on('change', function(e, p) {
      var interests = $(this).val();
      $('.franchisee-interests').val(interests);
    });

Also, rather than going with a full-blown ERB approach, when working with JS I find it easier to go with straight markup at times, although there's nothing stopping one from converting this example into ERB.

Before adding in chosen, I had ...(continued)

From Rails to Fulltime eCommerce Development on Solidus, a Spree fork

6a635003f0fd49d3dbc00ea98b4dd993

For the past 2-years, I've been working as a Senior Rails Developer for an award winning Digital agency based in the UK, and have had the pleasure of making an impact on global brands such as Autoglym UK.

During the last year I've dabbled in various languages from Swift, to Elixir, and even a little bit of Rust, but I think I've made the most advances in building and maintaining app stacks with Ansible, futhering my "DevOps" skills.

However, there comes a time when one must move on to bigger and better things. Thanks to a particular Ruby Hero, he put me in touch with a fantastic group of talented developers working on a fork of Spree, called Solidus. I have a sneaky feeling there's a reference to 'Solius Snake' somewhere.

Well, I'll be working fulltime on Solidus pretty soon, and am absolutely excited.

Post Archive