Multiplayer Tetris Game (part 4)

This tutorial continues where we left off on part 3. We will add some tests to make sure the game is working as expected.

Did it work? you can try the updated game here (Instructions: click to focus and use ↑←↓→ keys and WASD keys)

Multiplayer Tetris Game (part 3)

This tutorial continues where we left off on part 2. We will split the code into multiple files to make it easier to maintain and implement a few more game rules.

Multiplayer Tetris Game (part 2)

This tutorial validates the design we used to write code on part 1. We will try whether it's possible to fix bugs easily and whether we can add some new features to the game without major code/design changes.

Multiplayer Tetris Game (part 1)

A tutorial about writing a multiplayer game from scratch. Starting from solidifying the requirements and continues all the way up to creating a working prototype with vanilla js.

Solving Interview Problems

Sometimes, we get to solve programming questions on site during software engineering interviews. This is one of the questions I used to ask from those who have applied for software engineering positions at Creately.

Debugging RxJS code

This are undocumented internal details of RxJS and it can break anytime. It probably would have changed by the time you're reading this blog post. But still, there can be something similar.

Duplicate click events

While trying to debug this issue, we found out a couple of interesting things about how Angular manages event handlers.

The class in static methods

This is useful when writing static methods which can be inherited by other classes. Here's an example:

Async tasks sequentially

Let's check this badly written example first. The sequence below will run each step asynchronously.

Rant: JavaScript import syntax

The import syntax on javascript looks damn ugly when many items from a module. Take this example piece of code form a typical GraphQL code:

Transpiled JS on Github?

If you're maintaining a javascript project on Github there's a good chance you're using a transpiler. Most developers don't publish transpiled code to Github because it makes your pull requests look messed up and it's difficult to keep source and transpiled code in sync.

Using multiple GOPATHs

For an example, if we set the GOPATH environment variable to _/tmp/go1:/tmp/go2:/tmp/go3_ all three of them will act as GOPATHs.

Masking GraphQL Errors

The way **graphql-js** and **express-graphql** handle errors is has some issues. Consider this example server which has a bug in a resolve function.

Github repo license file

Github is without doubt one of the best things ever happened to open source software development. I, like many other FOSS developers, always use Github to host my projects. And like most of them I thought all of my public projects are by default open source.

Day 3: Packages

All go packages except packages from the standard library are placed inside the $GOPATH. A package consists of a set of go files in a directory. All go files should have “package mypackage” line before other code. There can be only one package per directory. Although it's not required It's expected that the directory name and the package name to be equal.

Day 2: Built-in Features

This tutorial consists of a number of example go programs demonstrating each feature. It is recommended to try some of them on the Go playground or on your local machine.

Day 1: Getting Started

The go playground is where go code can be run easily and fast therefore it makes an efficient place to try new go code. This also makes the playground useful when learning how to program with Go.

Go for Node developers

I'm developing Node apps for years and started working with Go last month. So far, I like it as much as I like Node. So I hope to blog some quick tips about Go (aka Golang) for Node developers starting with the $GOPATH. I'll start with some boring stuff and quickly move on to something useful. If you haven't tried go yet, [this](https://golang.org/doc/code.html) is a good page to start.

Errors vs. Bugs

One of the most important things I learned during past few months at MeteorHacks is the difference between errors and bugs and how they should be handled. I also found this [awesome article](https://www.joyent.com/developers/node/design/errors) on Joyent website which talks about error handling in node.

Isolated Testing

Just thought of sharing something about writing tests with JavaScript. Usually, it's best to keep tests simple and test just one thing per test (the _thing_ is most of the time just a _function_).

Empty Function Shorthand

JavaScript is an interesting language and so far my favorite. Maybe it's just me but I find stuff some people complain about javascript such as _automatic semicolon insertion, the way javascript scoping works and function/variable hoisting_ to be some of its best features.

Aggregation for Firebase

Assume we need to create a realtime dashboard to show some summary values. Usually, with Firebase, we'll have to get all data to the client and process them there. But this can only work for small data sets. If we have a few megabytes of data or more, this approach can get really slow. And we must aggregate values on each and every client application (web, mobile, etc).

‘Hello World' to MeteorJS

In this tutorial, I'll try to walk you through building a simple realtime wall (like a guestbook) where anyone can post messages. And let's try to do this without using any magic.

Organizing files in Meteor

Starting hacking on a project with Meteor is lots of fun. But things can become a mess very easily. Meteor does not have too much restrictions on how to organize our project files but it'll be useful to know some of its ways.

When not to "Fork" on Github

When I first started using Github, just like many others I simply went ahead and forked each and every repository I liked on Github. But this makes no sense at all.

Elastic Iframes

Sometimes it become necessary to use iframes when building some web applications. Often we have them hidden but sometimes iframes can be useful visible too.

Setting up wingpanel-slim

Elementary OS is one of the most beautiful operating systems I've ever used. Usually I mod my OS extremely but for the first time, I left _most_ of the OS defaults as is. The operating system UI is really minimal and if you use **wingpanel-slim** with auto-hide you can save even more screen space.

Create an empty git branch

It's really easy to create a new empty git branch with no parents (AKA orphan branches). First create an orphan branch with this command.