Image Image Image Image Image
Scroll to Top

To Top

Articles - Web design, web development, technology, mobile dev

20

Apr
2018

In JavaScript

By Manny

Reverse a string algorithm with JavaScript

On 20, Apr 2018 | In JavaScript | By Manny

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.

Tags |

17

Apr
2018

In Devops

By Manny

kubernetes cheatsheet, commands to remember

On 17, Apr 2018 | In Devops | By Manny

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

Tags |

15

Apr
2018

In JavaScript

By Manny

JavaScript map array helper method

On 15, Apr 2018 | In JavaScript | By Manny

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