Categories: Portfolio, Software Development

Speaking at PyCon Canada 2017 on “Python as a Philosophy”

I’m going to be in Montreal this weekend for PyCon Canada to give a talk on “Python as a Philosophy”. It will explore some of the ideas that are part of Python, built into its core and affect its community and how those ideas have spread to other software and software developers:

A number of programming languages that have not been used quite as frequently as others contain “profound enlightenment” that a developer learns through their use. Languages such as Lisp and Smalltalk are in this category. This presentation suggests that Python is also one of those languages. Python and PEP20 The Zen Of Python can affect how a developer writes code and then translates their practice into using other programming languages. For example, my own hands-on programming in Python has allowed me to carry on a number of practices into JavaScript and Ruby. The talk will specifically cover “explicit rather than implicit” code and the value of documentation as a developer-user experience. I will outline several examples and counter-examples of Python-inspired code practices within the context of JavaScript and Ruby.

Update: slides for the presentation are up.

https://speakerdeck.com/omouse/python-as-a-philosophy

Categories: Portfolio, Software Development, Web Dev Training

Stylelint: Lint your CSS

When working with CSS, developers usually don’t think about running a linter on the stylesheets. We usually use linters on C or C++ or JavaScript codebases. However, we don’t often think about whether or not it’s even possible to lint a CSS stylesheet and enforce certain coding standards and rules on it.

With Stylelint, you can lint your CSS and make sure it’s in line with common standards, more powerful than that is writing your own stylelint rules.

CSS Needs Linting Tools Just Like Other Languages

Here’s a few reasons why you would want to write your own custom rules for a linting tool:

  • You can make sure the code base is readable and consistent (a necessity for CSS!)
  • You can prevent some mistakes from happening (for example, always using parens around method calls in Ruby or CoffeeScript, or making sure every method has a comment explaining what it does)
  • Linters can warn you of potential issues (to take a Ruby on Rails or Django example, when you’re using the wrong method to get the count of items in the database)

So I sat down and read through the CSS stylelint guide on writing plugins and rules and came up with a basic example that other developers can build upon to lint their own CSS code.

Continue reading “Stylelint: Lint your CSS”

Categories: Portfolio, Software Development

Node.js Search Engine for Github Wikis

I wrote an article on how to create a search engine using Node.js for Github Wikis. The Github wiki uses markdown formatted pages and is very easy to get started with. It isn’t as fully featured as other wikis but it is a good starting point for organizations looking to build a knowledge base.

Searching through a github wiki isn’t very easy to do, so in the article you will see how to index each wiki page and tag it for search queries.

Categories: Portfolio, Software Development

Emacs Mode for Flow Type Annotations and React JSX syntax

Emacs Flow JSX: While I have been focusing on writing more about existing tools and how to use them, like Elm for frontend web development and Perl 6 just for fun, I still find a need to create new tools and update my own toolkit.

I’m working on a React project and it uses fancy new ES6 syntax in JavaScript and it also uses the Flow type checker. The first thing I noticed in Emacs, my text editor, was that the syntax highlighting was broken in strange ways whenever I opened up a JavaScript file that had type annotations or JSX in it. I asked on reddit for a solution to this problem and people pointed me to existing modes that kinda sorta did what I want.

So I decided to try and create a new syntax highlighting mode from scratch. This allows me to use the mode as a base for more interesting functionality; especially when I need to customize things for the React project I’m working on.

You can check it out here: https://github.com/omouse/emacs-flow-jsx

The #1 Reason to Use Emacs

This is the main reason I use Emacs. It lets me create new tools and update my tools to match the projects that I’m working on. I’ve done this over the years and it’s always been the one thing that keeps me coming back to Emacs. I have tried other IDEs and text editors and they do have their own conveniences but they just don’t have the power that Emacs has. Being able to define your own functions to automate repetitive tasks is great. Being able to define your own functions that turn a complex task into a simple task is even better.

Here are some examples over the years of tools I’ve built with Emacs Lisp to help me in my daily work:

Some other examples of functions I’ve written in Emacs Lisp to make it easier to work on a project:

  • Functions for jumping to the definition of a function or class
  • A function for opening the test/spec file of a class
  • Some functions to run a whole test suite on a virtual machine through SSH, and to run particular tests from the point I’m at in a file

All of these were customized for each project because each project has its own standards. Jumping to the definition of a class that’s written by your co-workers is different from jumping to the definition of a class that you’ve downloaded as part of another package (for example, searching through “lib/” rather than “node_modules/”).

If you decide to pick up Emacs and learn to use it, you’re going to be extra productive over the years, any initial hurdles you encounter will be worthwhile because your peak productivity will be higher than others in the long-term and that’s the #1 reason I keep using Emacs.

Categories: Portfolio, Software Development

React vs Elm: Creating a comment box component in Elm

I recently published an article on CodeMentor.io titled “Building a Facebook-like comment box: a React tutorial in Elm” where I use the Elm programming language to essentially duplicate the React.js tutorial.

Update: I conducted a webinar where we built an Instagram clone in Elm.

The article has code examples and a step-by-step on installing Elm, running the Elm Reactor and then writing the code for the comment box. There is no JavaScript involved aside from the JavaScript generated by the Elm compiler.

elm vs react tutorial on codementor by Rudolf Olah
Click above to read the Elm Tutorial on building a comment box just like Facebook’s

Comparing Elm to React for JavaScript Frontend Web Development

The article has a brief comparison between React and Elm. It explains why you would want to use Elm for building your JavaScript frontend:

While the performance of React is awesome, at a certain point, you will notice that having React just isn’t enough.

You’ll also want Redux, Flux, or some other data flow library installed.

You will want Webpack and Babel installed so that you can use the latest features of ES6 (also known as EMCAScript 2016).

Then you’ll probably want to add type-checking and static types at that point, so you will also need to install Flow, a JavaScript type-checker.

Elm will give all the goodies that React, Redux/Flux, and Flow give you but as a collective programming language rather than as individual libraries.

Essentially, Elm is a functional language with the framework built in for solid frontend web development, it compiles to JavaScript. It’s similar to TypeScript in that respect, however Elm goes much further because it has its own syntax for better type-checking and compilation.

Also, instead of having to find individual tools, everything that you need to create fast components and single page applications come with Elm. It’s a batteries-included language. It comes with a REPL (command line interface). The Elm-Reactor included with it will reload any changes you have made to an Elm file. With all these elements, it is the perfect language for rapid frontend web development. You can learn Elm quickly, and learn to quickly build, test, and refactor Elm components in a way that can’t be replicated by tools like TypeScript or ES6 or React or Angular.

Compare React and Angular To Elm

So while React is great for creating web components, when we compare it to Elm, it can be hard to get started because it requires a bit more infrastructure around it (with Babel, Webpack, Flow, TypeScript, etc.) to really get started on developing a production-ready web application.

Note: React isn’t the only JavaScript framework/language/library to suffer from this, Angular also has a problem with setting up infrastructure (as do other JavaScript libraries). This is probably why React killing Angular in the JavaScript web framework wars is not so far-fetched. You can learn React and Angular fairly easily for the simple tasks. However, when projects become complex, the infrastructure starts to get in the way and it can be hard to learn how to debug the issues. It may be possible that if you compare other JavaScript frameworks like Vue.js to Elm, you will find they have better infrastructure and a good developer feedback loop.

Updated: Instagram Clone Article Published

It’s one of the first pieces of code I’ve written in Elm. I have been working on two other projects; one is an Instagram-clone, which I did an “office hours” live coding session for on CodeMentor.io.

The instagram code is neat because you can see how quickly you can write up a grid layout. You can see how to work with modals/pop-ups and how to manage state within an app. You can check out the code for the instagram clone here. The instagram clone is licensed under the Apache license 2.0.

Event Creation Tool written in Elm

The event creation tool for an event ticket sales page is cool. It explores more state management in the context of an app. For example there’s a way to switch the type of event you’re creating in the app. When you switch, an explanation page appears in between to give you guidance on how to create the different type of event that you just switched to. the event creator web app is licensed under the AGPL. You can check out the code for the event creation page for an event ticket sales website is here.

More Articles On Elm

I will be publishing another article on Elm (update: it has been published) very soon that is a continuation of the Instagram-clone code. It will include an API server to show how to use HTTP and AJAX calls. Furthermore, it will show you how to embed and fullscreen a component. This is vital if you want to use Elm today in an existing project and integrate components in a piecemeal fashion.

2017 UPDATE

instagram clone in elmUPDATE: The 2-part article on creating an Instagram clone in Elm (instaelm) has been posted on Codementor:

 

Categories: AngularJS, Portfolio, Software Development

Forget React, Learn AngularJS 2.0 with this video tutorial!

In the last few weeks I’ve been busy preparing AngularJS 2 courses and I’m really excited about the first video tutorial that NeverFriday Software Expertise is releasing.

1

In this tutorial you learn how to create an AngularJS 2.x project and how to create a comment box directive component. In the React tutorial, they show you how to create a comment box just like on Facebook so I thought, why not show how easily it can be done in AnagularJS 2?

And let me tell you, it was really easy. AngularJS 2 has all the same features you liked in AngularJS but it has a better structure and better modularity. I just made a giant list of differences between Angular 2 vs 1.

Learn AngularJS 2 and create a cool component in less than 30 minutes. Click here to buy the video (prices go up in November so buy it now!)

 

Categories: Portfolio, Software Development

Use JSON in Perl 6, article published

I wrote an article for codementor.io on how to use JSON in Perl 6.

It’s a good tutorial and introduction to Perl 6 which hasn’t seen wide adoption yet. It’s a solid language which has had a lot of thought put into it and the libraries that exist for it so far are good. Since it’s still Perl, it has that hack-y, fast-paced feel to it where you feel like you can quickly put together a one-off script to get the job done or put together an MVP (Minimal Viable Product). However, since Perl 6 is better designed, you can build a well-structured, well-engineered large project.

Learning new languages and how they work can help make you a better programmer and introduce new ways of thinking that can make it easier for you to find solutions to technical problems.

Categories: Software Development

Perfect demonstration of the necessity of metaprogramming

An employee at SoundCloud has a guide on writing React.js and Redux. The current SoundCloud app is written in Angular.js 1.x and they have their own flux-like library. The guide is a guide on how to build a SoundCloud client web app using React.js and Redux. It’s a perfect demonstration of why metaprogramming is necessary for larger projects and in particular for the JavaScript ecosystem.

Instead of writing a new app from scratch, this guide could have been a guide on specifying the SoundCloud client app in a meta-description language. Then using that meta-description language to generate all of the React.js and Redux code that is needed.

Unfortunately, this guide is plain programming with no metaprogramming at all.

Continue reading “Perfect demonstration of the necessity of metaprogramming”

Categories: Life, Software Development

Full Stack Toronto June 2016 Meetup

A few days ago I attended the Full Stack Toronto meetup. The theme of this meetup was Celebrating Pride in Tech.

The first speaker, James Wilkinson (executive director of Full Stack Toronto), spoke about front-end web development optimizations. What was really cool was the overview of the tools that are available for checking performance. The part about having a performance budget for website load time was great and gave me some ideas on how we would determine what a good baseline budget is for the current project I’m on.

The highlight for me was that those hero images take a while to load and James walked through the painting that happens in a web browser to show what happens on slower internet connections. Having a huge hero image means there’s going to be a blank spot on your website while it loads on a phone or 3G-connected tablet.

The slides for “Auditing The Front-End for Performance and Scalability” are here.

The second speaker, Avery Francis, who works at Rangle.io as a talent manager. Her talk was about diversity in tech and some of the ways that organizations can improve their hiring practices and their company culture to make it more diverse and inclusive. She also went over a few reasons why you want more diversity such as better work atmosphere and increased productivity (therefore….increased profits). Personally, a more diverse and inclusive environment is typically more comfortable and has a really amazing impact on product. More diversity leads to more viewpoints and perspectives and leads to better user experiences in products.

Continue reading “Full Stack Toronto June 2016 Meetup”

Categories: Software Development

node-oauth-libre 0.9.15 ALPHA

I’m very excited. After starting a fork of node-oauth-libre a month ago, I have implemented a feature that many people have wanted for months: Promises instead of callbacks.

Promises are a way of escaping from Node’s callback hell.

node-oauth-libre now has support for promises thanks to the bluebird library. This support is optional and does not break compatibility with existing uses of node-oauth. To use it, you must explicitly import it.

Click here to check out the release notes for node-oauth-libre 0.9.15 ALPHA. The install and usage instructions are there and a link to some examples.

Here’s an example of using OAuth 1.0 promises:

https://gist.github.com/omouse/0bf79ac1d1edf6a036482e6cb0de9a8f