Designer. Developer. Writer.

Hi. there..

I'm Pankaj Parashar, 26yo developer, designer and writer from India. I make things for the web and write about them on my blog here.

 • 

Mocking Python

The Python mock library has largely been a black hole when it comes to efficiently unit testing a Python code. Hopefully, this article will help you understand the essential bits to bump up that test coverage.

 •  Share

 •  External link

Beyond PEP8

Raymond Hettinger is a Python Core developer and has an amazing knack of explaining concepts related to Python in a succint manner. His talk at PyCon US 2015, titled “Beyond PEP8” revolves around the hazards of the PEP 8 style guide and learn what really matters for creating beautiful intelligible code.

If you’re interested in viewing Raymond’s past talks, then you could follow this playlist that has most of the videos for his talks.

Read more

 •  External link

A friendly Readme

Rowan Manning writes about the importance of writing a friendly README for your project, which is perhaps in my opinion is the most underrated yet extremely important part of maintaining a project.

Read more

 • 

Introducing Atomize IO

Over the weekend, I pushed out a new update to the Atomize IO app and this post is all about, explaining how those numbers are calculated.

 •  Share

 •  External link

How 11 lines of JavaScript broke the Internet?

Roughly around 1430 hours Pacific time on Tuesday, March 22nd, 2016, @npmjs observed hundreds of failures per minute for missing dependencies requesting for the now-unpublished package, left-pad. Notably popular open source libraries like Babel, React etc stopped working as this package was enlisted as one of the dependencies in the package.json file.

This resulted into large-scale build and deployment failures across the internet, and eventually led to mass fallout on Github, Twitter, Reddit and Hacker News.

What is this package for?

At the time of writing, left-pad is one of the most popular open source package registered at NPM, with roughly 2.5M downloads per month. All it does, is implement a basic left-pad string function using just 11 lines of JavaScript,

module.exports = leftpad;
function leftpad (str, len, ch) {
    str = String(str);
    var i = -1;
    if (!ch && ch !== 0) ch = ' ';
    len = len - str.length;
    while (++i < len) {
        str = ch + str;
    }
    return str;
}

What happened behind the scenes?

Azer Koculu, the developer of this package pulled out approximately 250 packages from the NPM registry (including left-pad) in protest to alleged harassment from the patent lawyer of the Kik messaging app. Azer has blogged about his version of the story on Medium. Shortly after this went live, Mike Roberts, a head of messenger at Kik, came up with their side of the story.

Mike’s response shows Kik in poor light, as evident here,

@Bob Stratton (Kik’s patent lawyer) - We don’t mean to be a dick about it, but it’s a registered Trademark in most countries around the world and if you actually release an open source project called kik, our trademark lawyers are going to be banging on your door and taking down your accounts and stuff like that — and we’d have no choice but to do all that because you have to enforce trademarks or you lose them.

NPM were not far too behind in publishing the timeline of the events as it unfolded on thier blog.

Who’s to blame?

Some of the folks in the community think that @Azer reacted too aggressively by unpublishing all the packages in anger. Majority of the people agree that @Kik were trying to bullshit their way with lawyers and patents to streamroll a hapless open-source contributor. @npmjs failed to play it nicely too, as they transferred the ownership of the package without acquiring consent from the owner or sending prior notification.

All in all, David Haney, who works at StackOverflow, came up with an interesting piece to sum up with the conclusions that the Node.js community should take the blame too!

Shortly after I published this piece, the Internet just broke again! but this time not due to an error but due to this, left-pad.io!

Read more

 •  External link

PEP8 for Humans

The PEP8 standard has been known to be mysteriously obscure for the beginners. Kenneth Reitz, the man behind Requests: HTTP for Humans has re-written the PEP8 style guide so that humans can read and understand it too!

Read more

 •  External link

The Apple FBI saga

For a comprehensive rundown on the technical aspect on this saga, follow the link. TL;DR? Continue reading the following summary.

The Case

In the San Bernadino shooting, FBI found an iPhone 5C of one of the gunmen. The FBI has a search warrant to check the contents of the iPhone to build its case.

The Challenges

Unfortunately, the iPhone is locked with a passcode and predictably the FBI doesn’t know the passcode. So obviously someone in the FBI needs to guess the passcode to unlock the iPhone. Brute force!, But it is not that simple, why?

What FBI is asking Apple to do?

In lay man terms, FBI is asking Apple to build a backdoor entry by,

In nutshell, FBI is asking Apple to build a custom version of iOS and install the OS directly on the RAM without affecting the user data.

Is it challenging for Apple to meet FBI’s demands?

No. But Apple is more worried that this backdoor entry (read ‘custom iOS’), if it falls into the wrong hands can lead to misuse. If you found this difficult to comprehend, then you are better off using an Android phone! Phew!

Read more

 • 

ES6 - 101

ES6 known to many as Harmony or es-next or ES2015 (preferred way) is the latest specification in the JavaScript world. In this article we'll go through some of the improvements and enhancements that ES6 has to offer.

 •  Share

Atomize IO

Atomize is now the new Optimize in the frontend development domain. Atomize.io is a handy little tool to check how much your website can benefit from the adoption of Atomic CSS.

If you don’t know what Atomic CSS is, then I would strongly recommend checking its website. I’ve also included direct links to top 25 most popular websites in the world and surprisingly those folks have plenty of work to do!

Sample results for twitter.com
 •  External link

Offline Web Applications

Mobile-first applications have now been replaced by Offline-first applications. Predictably, offline first applications enhances the user experience by providing a consistent user interface, even when the user is suffering from poor internet connectivity or absolutely no internet connection.

Udacity is offering a free online course to build offline-first web applications by Jake Archibald. For those who don’t know, Jake is perhaps the most knowledgeable person when it comes to building offline apps, having written some amazing articles on this topic on his blog.

Read more

Codelab IO

Over the weekend, I dished out a realtime in-browser code editor, perfect for collaborating online with other developers. It can also be used as a whiteboard to interview candidates distanced by geographical location. As far as the technology stack is concerned,

Screenshot for Codelab in action
 •  External link

Building Custom Web Components with X-Tag

After Google and Mozilla‘s solutions for web components, it is now Microsoft’s turn to enter this space with their public release of the X-Tag library. I have turned this into an article for SitePoint, explaining how to build a Google Map street view custom element using the X-Tag library.

Checkout my SitePoint authors page, to read more articles of mine!

Read more

 • 

Whats new in Python 3.5?

Python 3.5 was released in the 2nd week of September, 2015 and brought a bunch of useful changes with it. In this article, I'll be discussing some of the enhancements to the language that I found extremely useful in the latest release.

 •  Share

 •  External link

Password strength meter

After a long time, I have finally managed to write an article for CSS-Tricks, on my beloved topic, the HTML5 meter element. This time, I’ve used the HTML5 meter element to create a password strength meter, indicating the user how easy or difficult is to crack the password.

Illustrating the password strength indicators from eBay(Top), Gmail(Middle) and Dropbox(Bottom) in varying forms, essentially representing the same information.

Read more

 • 

Introducing Pandas

The intent of this post is to introduce you to the Pandas library by performing common tasks like reading, writing files and manipulating data.

 •  Share