Skip to content

Instantly share code, notes, and snippets.

View craftybones's full-sized avatar

Srijayanth Sridhar craftybones

  • Bangalore, India
View GitHub Profile

TODO List Manager

Extend the existing to-do application to support multiple todo lists. Users should be able to create and manage separate lists, each with its own set of todo items.

Features

  • Create a new todo list by providing a title.
  • View all existing todo lists.
  • Add a todo item to a specific list.

Playlist Manager

Overview

The Playlist Manager is a simple web-based application that allows users to create and manage playlists. Users can view all playlists, inspect individual playlists, add and remove songs, and delete playlists.

Features

1. View Playlists

Extend generatePattern with a Secondary Pattern

Instructions

Your task is to modify the generatePattern(style, dimensions, secondStyle) function to support generating two patterns side by side. The patterns will share the same dimensions and will be separated by a single space.


Key Details

Hollow Diamond Pattern

Instructions

Your task is to extend the functionality of the generatePattern(style, dimensions) function to support a new pattern type: hollow-diamond.

For this assignment, the style parameter will be "hollow-diamond", and the dimensions parameter will be an array containing a single number [size] where:

  • size specifies the width and height of the diamond (both are the same).
  • Only odd numbers are valid for size:

Assignment: Diamond Pattern

Instructions

Your task is to extend the functionality of the generatePattern(style, dimensions) function to support a new pattern type: diamond.

For this assignment, the style parameter will be "diamond", and the dimensions parameter will be an array containing a single number [size] where:

  • size specifies the width and height of the diamond (both are the same).
  • Only odd numbers are valid for size:

Right-Aligned Triangle

Instructions

Your task is to extend the functionality of the generatePattern(style, dimensions) function to support a new pattern type: right-aligned-triangle.

For this assignment, the style parameter will be "right-aligned-triangle", and the dimensions parameter will be an array containing a single number [size] where:

  • size specifies the number of rows in the triangle.
  • Each row is right-aligned, meaning that the * characters are preceded by spaces ( ) to align them to the right edge of the triangle.

Triangle

Instructions

Your task is to extend the functionality of the generatePattern(style, dimensions) function to support a new pattern type: triangle.

For this assignment, the style parameter will be "triangle", and the dimensions parameter will be an array containing a single number [size] where:

  • size specifies the number of rows in the triangle.
  • The width of each row corresponds to its row number (1-based). For example, the 1st row has 1 *, the 2nd row has 2 *, and so on.

Alternating Rectangle Pattern

Instructions

Your task is to extend the functionality of the generatePattern(style, dimensions) function to support a new pattern type: alternating rectangle.

For this assignment, the style parameter will be "alternating-rectangle", and the dimensions parameter will be an array [columns, rows] where:

  • columns is the number of columns in the rectangle.
  • rows is the number of rows in the rectangle.

Early exits

Early exits are a coding technique where we return from a function as soon as we encounter a condition that prevents further execution. This approach simplifies code, improves readability, and can enhance performance by avoiding unnecessary computations.

function occurrences(string, substring) {
  const lastIndex = string.length - substring.length;
  const isSubstringEmpty = !substring;

  let subStringCount = 0;

From Hardcoded Squares to Flexible Patterns

The humble checkerboard, with its alternating squares of light and dark, holds surprising depth when it comes to programming. Generating this familiar pattern can be tackled in various ways, each showcasing fundamental programming concepts and revealing their strengths and limitations. Let's embark on a journey through code, using the checkerboard as our canvas, to explore these concepts and discover the art of building flexible and efficient solutions.

A simple printf

This section presents the simplest approach to generating a checkerboard pattern using the printf function. Here, we directly print hardcoded strings representing alternating rows of "1"s and "0"s.

#include