Sallar Kaboli / Exploring JavaScript & Things.

I started refactoring Buttercup’s UI about 8 months ago I had no idea how difficult it’s going to be. Why I Refactored Back in 2015 when Perry and I started making Buttercup, I decided to use BackboneJS for coding the front-end part of things, and it went well for a while. But I quickly realized BackboneJS is not suitable for what Buttercup wants to achieve. Backbone does not scale well in large applications IMO. To name a few issues we had: Very manual way of rendering and re-rendering. Rendering in BackboneJS is done by replacing the dom contents manually using a jQuery method ($(...).htm

red more

Recently I went to a technical interview in a big tech company for the front-end engineering role. Regardless of how I feel about their process and how unrelated the test was to the job, I found one of the questions interesting and thought it would be nice if I post my solution here. Here’s the problem: There is an elevator in a building with M floors. This elevator can take a max of X people at a time or max of total weight Y. Given that a set of people and their weight and the floor they need to stop, how many stops has the elevator taken to serve all the people? Consider the elevator se

red more

Disclaimer: A repost of my article for CafeDev A while ago I needed a sim­ple string pad func­tion, and since it’s a freak­ishly sim­ple task, I just wrote a sim­ple func­tion: function limit(str, limit = 16, padString = "#", padPosition = "right") { const strLength = str.length; if (strLength > limit) { return str.substring(0, limit); } else if (strLength < limit) { const padRepeats = padString.repeat(limit - strLength); return (padPosition === "left") ? padRepeats + str : str + padRepeats; } return str; } Pretty sim­ple, right? And it

red more

I started learning to code when most things were closed source; at least they were to me. There was no Github and the internet wasn’t something I could effortlessly access. Nothing like today. I had to try hard to create something, and I was taught to never reveal my secret once I’ve created it, since it was my intellectual property and my road to success. How wrong I was. Even the best programmers make mistakes, and they can’t know everything. Creating software isn’t possible without collaboration, brainstorming and different skills. One person can not know all. And it’s not everyday that y

red more

It’s been couple of months that Perry and I have been working on our own password manager called Buttercup. We released the very first alpha version today, and you can get it from Github now. Mac and Linux versions are ready at the time of writing this post and a Windows version is underway. What’s Buttercup The existing solutions out there are quite good, but not exactly what we wanted. We needed a free, well-made, open-source and secure password management solution, so we decided to build our own. We put all of our trust in Javascript and started coding it in Javascript using NodeJS and El

red more

**tl;dr**: Calculating mouse wheel value across browsers is a real pain in the ass. Avoid it as long as you can. So nowadays there’s all these talks about React, Redux and so many other cool things to do. But usually at our day jobs, we can’t just start using all these modern things. We have IE9 customers to think about and we have to make sure our stuff won’t break for them, otherwise we’d be out of business. Recently I’ve been given a task at work which involves mouse wheel/trackpad scrolling. I’d have to capture that event, change it’s speed and velocity, and animate an element using tha

red more

We decided to do a small hackaton at Kiosked during summer which was all kinds of fun. Couple of colleagues and me decided to make an app for finding the best restaurant to go to for lunch, which as you know isn’t an easy thing to do ;-) Our lunch app was called Lunchify and it would do these things: Show the list of venues based on location proximity Show lunch menu for each restaurant Show directions to the venue (navigation) Cordova/AngularJS As a strong believer in Javascript, I suggested we build the app using Javascript so it would be easier to implement and also be cross-platform. Th

red more

I like Javascript Promises a lot, so I’m trying to fit them everywhere in my apps. If you haven’t heard about Promises, or haven’t used them yet, I suggest you check out this great guide on them. I also like ES5 array functions and in my opinion they’re a few of the best additions to the language. My favorites are filter and map. The problem with these functions is they are synchronous, and I find myself trying to do something like this: var result = arr.map(function(item) { // Do something Async here. }); Which clearly isn’t going to work out since the callback function passed to map n

red more