Categories
JavaScript

Async HTTP Requests

Working with the web you will have to at some point get some data from some where. You might like to call an API. Here is an example of a classic XML HTTP request. There are more modern ways of retrieving data, like using fetch() api, thats cool… I will make another post about this.

Async is short for Asynchronous. This means an operation that happens one at a time after the previous operation has completed.

XML HTTP Request

sources: 

http://shop.oreilly.com/product/0636920032151.do

https://github.com/toddmotto/public-apis

Categories
Computer Science JavaScript

fizzbuzz – JavaScript

Fizzbuzz Programme, is a program that prints the numbers from 1 to 100.

For the multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”.

For numbers which are multiples of both three and five print “FizzBuzz”

Categories
Podcast Web Development

My favourite podcasts

I love podcasts, I’m addicted for sure here is a list of some of my favourites. If you have any cool podcasts please share in the comments below, thanks.

ZADevChat

https://zadevchat.io/

Za Dev chat is local South African series where Kenneth Kalmer and friends div into the technicalities of software engineering. I was a guest on episode 33.

 

a16z Podcast

https://a16z.com/podcasts/

A podcast by Andreessen Horowitz. If you are interested in current affairs in the tech space from a global perspective, these guys are sharp.

 

Responsive Web Design Podcast

https://responsivewebdesign.com/podcast/

Karen McGrane and Ethan Marcotte interview companies who have undergone the process of upgrading legacy non-responsive websites into fully fledge responsive websites. They dig into technical and non-technical aspects of site builds.

 

Syntax

https://syntax.fm/show/044/how-to-learn-new-things-quickly 

Wes Bos and Scott Tolinski talk about all things web, focused on JavaScript.

 

Shop talk show

http://shoptalkshow.com/

Chris Coyer, say no more author of CSS Tricks, this podcast is a mix of audio and video on all aspects of web design and development.

 

Developer tea

https://spec.fm/podcasts/developer-tea

 

Disrupt Yourself

http://www.podcasts.com/disrupt-yourself-podcast-with-whitney-johnson-87

Whitney Johnson interviews one on one with celebrity/accomplished CEO’s, inventors, writers, makers, and she gets them to divulge their secrets to their success.

 

Fullstack Radio

http://www.fullstackradio.com/

 

How I Built This

https://www.npr.org/podcasts/510313/how-i-built-this

 

Hack to Start

http://hacktostart.com/

 

Laracasts Snippet

https://laracasts.com/podcast

 

Categories
JavaScript

Reverse a string algorithm with JavaScript

Ever wondered how many different ways you can write a reverse string algorithm in JavaScript?

You can use a combination of helper methods built into JavaScript:

split(”);
The split method separates the string into substrings, which are separated by a given separator. The separator can be a blank space, comma or whatever you need.

reverse();
The reverse method changes the order of the element in the array in situ at call time. The zeroeth element will become the last element in the array and the last element the first in the array.

join(”);
The join method will recombine all the given items in the array and then return the array.

Categories
Devops

kubernetes cheatsheet, commands to remember

Here are some useful kubernetes commands for future to me to look back on and remember. Maybe you find them useful too.

get pods
kubectl get po
and
kubectl get po -w
-w is for watch so you can watch your pods die and come back to life

create deploy
kubectl create -f myawesomeconfig.yml

delete deploy
kubectl delete my-not-so-awesome-deployment

exec into pod
ssh into pod to do terminal stuff like working with your interactive Python, PHP or node shells
kubectl exec -ti my-awesome-app-1234 bash

get services
kubectl get sv
and
kubectl get services

read logs
kubectl logs my-awesome-app

decribe pods, get detailed information about the pods status
kubectl describe po my-awesome-app

Categories
JavaScript

JavaScript map array helper method

Map is used when you want to modify data in some list or array and return a new modified array from that original array.

I’m really enjoying cryptocurrency and all the fanfare that comes with it, so let’s use an array of crypto prices in our code example.

Let’s:

  1. iterate through the array
  2. pull out all the prices which happen to be the second property of each currency object
  3. save these prices into a prices array

Categories
Books Computer Science

Computer Science Distilled

I recently finished reading an awesome book recommended to me by a friend (thanks, Melvin), Computer Science Distilled: Learn the Art of Solving Computational Problems. I highly recommend it.

What to Expect?

It’s fast-paced expertly written summary of concepts in computer science: Iteration, Recursion, Data Types, Databases, Algorithms, Programming paradigms.

Favourite Chapter?

I loved the chapter on databases, Wladston starts out with explaining Relational databases, Non-relational databases, No-SQL vs SQL databases and he also takes it a step further and explains how one can make database systems distributed – highly available by using replication techniques. Touches on Single-Master replication and Multi-Master replication.

This isn’t the kind of book you read once, it’s one to keep coming back too I loved this book. You should try it too.

 

Categories
Audiobooks Devops

The Phoenix Project

I recently got into audio books and became an Audible subscriber. One of the first books I got stuck into was The Phoenix Project by Gene Kim, Kevin Behr, George Spafford.

This is a great book (audiobook). I had so much fun listening to this book in the traffic and on the bus rides into work, I highly recommend it if you are in the IT industry. It’s fast paced listening very funny and dramatic in places.

You should check it out for sure.

 

Categories
Design

indent design studio, typography, branding

Hello there fellow designers, developers and internet travellers. I would like to introduce you to dear friend of mine. Denton, he runs a design studio in Cape Town specialising in custom typography and branding you should total check him out. Its not often you come across such dedicated craftsmanship these days, every detail matters and you can see it in the work.

Here are some samples of his work =>

indent design

Want to see more go to www.indent.design

Categories
JavaScript

What is a forEach method

The forEach method is a special kind helper method available to us on an array.  It helps us loop/iterate over an array. It is an alternative method to iterating over an array using a for loop.

for loop

[sourcecode language=”javascript” wraplines=”true” highlight=””]

var cars = [ ‘Lambourgini’, ‘Porsche’, ‘Ferrari’, ‘Mazarati’];

for (var i = 0; i < cars.length; i++) {
console.log(cars[i]);
}

[/sourcecode]

forEach

[sourcecode language=”javascript” wraplines=”true” highlight=””]

var cars = [ ‘Lambourgini’, ‘Porsche’, ‘Ferrari’, ‘Mazarati’];

cars.forEach(function(car){
console.log(car);
});

[/sourcecode]

When we call the forEach method we pass it an anonymous function, this is that internal argument. This function gets called one time for element in the cars array. This function can also be called the iterator function. In this example it will get called four times.

We can also extract the anonymous function to a listCars function that will later be passed in as an argument to the forEach method.
[sourcecode language=”javascript” wraplines=”true” highlight=””]

var cars = [ ‘Lambourgini’, ‘Porsche’, ‘Ferrari’, ‘Mazarati’];

function listCars(car){
console.log(car);
}

cars.forEach(listCars);

[/sourcecode]