Skip to content

CollegeStash

  • Software Engineer Interview Prep
  • System Design
  • Frontend
  • Contact
  • Search
  • Restart service if website is down with cronjob

    This can be easily achieved on a linux server with the help of a cronjob.

    Open up your terminal and edit your cronjobs list using sudo crontab -e. (more…)

    February 6, 2018
  • Divide CSS3 Grid into fixed equal columns

    Defining a fixed set of equal width items for each row in a grid can be done using the grid-template-columns property in CSS3.

    (more…)

    February 4, 2018
  • Create Schematic using Schematic-CLI from angular-devkit

    We can easily create a new schematic which we can use with the help of Angular-CLI in few minutes. Install the required package globally using npm as shown below. You will need node version >= 6.9 for this. (more…)

    February 2, 2018
  • Detecting Angular Router State Changes

    Detecting Route state changes can be done by subscribing to the router and listening to the events being emitted. In the example below you will see all the router events that you can listen to in Angular. (more…)

    January 29, 2018
  • Angular Material with Angular 5

    Install the latest version of Angular Material + Animations using npm to get started.

    npm i --save @angular/material @angular/cdk
    npm i --save @angular/animations

    (more…)

    January 25, 2018
  • Javascript call() vs apply() vs bind()

    call

    The call() is a predefined Javascript function which can used to call a method of an object while passing it another object. For example, if you look at the following code, you will observe that the object being passed into the call() method replaces the this variable of the object whose method is being invoked. (more…)

    January 22, 2018
  • Testing Component with Service (Promise) in Angular

    To perform unit testing on a component that makes use of a service, that returns a promise, we can use fakeAsync() and spy() methods from Angular’s unit testing package. (more…)

    January 20, 2018
  • Passing an object vs primitive data type in Js

    In Javascript, when you pass a primitive data type like String or Int in Java to a function or a method, and a function modifies it, then this does not effect the actual data being passed. For example, (more…)

    January 19, 2018
  • Floyd Warshall Algorithm

    The Floyd Warshall Algorithm is used to find the shortest distance between all pairs in a weighted graph with positive or negative edges. It makes use of Dynamic Programming.

    • If A, B, C are vertices, then this algorithm checks for the following
      if (AC > AB + BC)
      AC  = AB + BC;

    (more…)

    January 16, 2018
  • Kth largest element in an Array

    Kth largest element in an array can be determined using the “Quickselect Algorithm”.

    Average performance O(n)
    Worst-case performance O(n^2)

    (more…)
    January 16, 2018
←Previous Page
1 … 13 14 15 16 17 … 28
Next Page→