How to Scroll to Top of Page on Changing Location in AngularJS App

In this post I discuss a quick way of fixing a minor annoyance you may experience while developing apps with AngularJS. Specifically, you may notice that when your app navigates from one url to another, the scroll location remains the same, which could causes lots of usability issues. To fix this, in your Angular module’s run method, call anchorscroll() in a callback function to the $locationChangeSuccess event as follows:

.run(function($rootScope, Auth, $state, $anchorScroll){
    $rootScope.$on("$locationChangeSuccess", function(){


Changing route doesn’t scroll to top in the new page. Stack Overflow.

My First Egusi Soup

Today I cooked egusi soup for the very first time and boy was it delicious! Eating egusi soup with pounded yam was sheer pleasure. For the unfamiliar, egusi (also known by variations including agusi, agushi) is the name for the fat- and protein-rich seeds of certain cucurbitaceous plants (squash, melon, gourd), which after being dried and ground are used as a major ingredient in West African cuisine [1]. Cooking egusi soup required utilising all of my cooking skills. Trust me, it is much more complex than making tomato soup, even with okro. But it was very rewarding. Here are the ingredients and procedure I followed to cook it.


  • Whole crayfish
  • Whole melon
  • Chicken
  • Maggi chicken cubes
  • Spinach
  • Onions
  • Palm oil
  • Pepper
  • Bell pepper
  • All purpose seasoning
  • Salt
  • Stock (from boiling chicken)


Prepare the chicken

Thaw the chicken

Wash chicken

Put chicken in a pot

Add water

Start to boil chicken

Slice one onion into pot for taste

Add a handful of salt

Add All Purpose Seasoning to the pot

Let the chicken boil.

Once the chicken boils, remove it and store it somewhere. Keep the stock as we will use this later.

Broil the chicken in an oven at 150 degrees C for about 15 minutes.

After broiling keep the chicken in a bowl to be used later.

Wash the pepper and bell pepper.

Slice both pepper and bell pepper into little bits.

Wash the spinach

slice the spinach

Wash the sliced spinach and keep it in a bowl for later.

Blend the melon in a blender adding a bit of water to facilitate the process. Keep the paste in a bowl.

Blend the crayfish with a bit of water as well and set it aside for later.

Put palm oil in a pot and heat it so that it is hot

Add sliced onions to the pot

Add sliced pepper and bell pepper to the mix.

Add blended melon to the pot.

Stir the mixture very well a bit to avoid it sticking to the pot.

Allow it to fry for a few minutes.

Then add blended crayfish to the mixture.

Add stock and stir the whole thing together.

Add a bit of water to the pot and allow the food boil.

Add salt and four Maggi cubes.

Add chicken to the pot and stir it a bit.

Then add spinach and mix it into the soup gently so as to avoid breaking the chicken.

Cover the pot and let it cook for a few more minutes.

Egusi soup is ready!

Note that I didn’t make it by my own knowledge. I give big props to Sisi Yemmie’s excellent guide [2] as well as Josephine’s thorough instructions [3]. Also, the procedure I followed isn’t unique. There is a lot of¬†flexibility in how to make it. For example, the guides I followed recommended using grounded egusi and grounded crayfish as opposed to the whole ones which I used and had to blend myself. Also, it’s possible to use various meats like ponmo (tripe), turkey, etc. to cook it. Iru (locust beans) can also be used when making the soup. There is even flexibility on what vegetable to use. I used spinach, but it’s also possible to use pumpkin leaves. Some even use tomato puree as well in making it. See the two Youtube videos I followed for more details.


1. Egusi – Wikipedia. [22/1/2017].
2. HOW TO COOK EGUSI SOUP! [22/1/2017].
3. How to make Egusi and vegetable soup. [22/1/2017].

How to exclude a folder in find command on a Mac

In order to exclude a folder with find command on a mac, you need to use to command:

-path ./path-to-exclude -prune -o

E.g. to find .txt files in the current folder without descending into a folder called foo, use the following command:

find . -path ./foo -prune -o -name '*.txt'


linux – Exclude directory from find . command – Stack Overflow. [17/01/2017].

A Cool Way to Clear Floats When using Compass

There are a variety of ways to clear floats with working with html, one way being to create a div with style: clear: both after the last floated element. A more elegant way, when working with Compass, is to use clearfix. Here’s how to go about it.

@import "compass/utilities/general/clearfix"
.some-element-to-clear-floats-for {
  @include clearfix();


Compass Clearfix | Compass Documentation. 9/1/2017.

How to Record and Repeat Key Sequences in Vim

When using Vim, I find it very handy to record and automatically repeat key sequences over multiple lines. E.g. suppose you want to extract the content from HTML markup, you could use this technique to record how you extract the text from the first line (in a way that can be repeated throughout), then repeat your actions over all the other lines. Such a recording is known as a macro and here is how to use it.

First, we want to store our macro in a register, let’s say we want to store it in 1. We start recording by clicking q1. On the status bar, the text recording @1 should appear indicating that your actions are now being recorded.

Then we perform our key sequence on the first line.

Once done, press q. The recording @1 text on the status bar should disappear.

Now, to repeat the actions saved on another line, move your cursor to that line and press @1.

If you want to perform the actions over, say the next 10 lines, then simply press 10@1.



How to Make Checkbox Checked by Default in AngularJS

Here’s a quick tip on how to set a checkbox as checked by default when developing an app with AngularJS. In your controller, suppose you’re storing the form in a field someCheckboxField under a form variable someForm. All you need to do is set the field to true


$scope.someForm = {
    someCheckboxField: true

Then in the template, make sure the checkbox has ng-model set appropriately, e.g.

 <input type='checkbox' name='someCheckboxField' ng-model='someForm.someCheckboxField' />

Web Application Testing with BrowserStack

Today while looking for a machine running IE to debug a web application I was working on, a friend of mine referred me to a platform for testing on various browsers called BrowserStack. So I gave it a shot, and boy, was I amazed!

BrowserStack allows you test web applications on various browsers on multiple operating systems. Desktop and mobile devices are supported. The website provides a free trial so users can test drive it to see if it is to their liking. Registering for an account was quick and easy.

While testing I was able to use local urls, e.g. localhost:3000, saving me time. The app worked quite swiftly as well. The only critique I have of it is that the session times out rather quickly if there isn’t any activity.

So, if you are thinking about a good solution for testing web apps on multiple browsers, give BrowserStack a try. Visit their website to get started.