Skip to content

Instantly share code, notes, and snippets.

View Kash2910's full-sized avatar

Mohammed Kashif Siddiqui Kash2910

View GitHub Profile
@Kash2910
Kash2910 / Whact-a-mole.js
Created May 14, 2023 20:36
Whack a mole
// HTML
<html>
<head>
<link rel="stylesheet" href="./src/styles.css">
</head>
<body>
<h1></h1>
<div>
<div>
<h2>Click start to play!</h2>
@Kash2910
Kash2910 / App.js
Created April 16, 2022 19:36
Take-home: School shopping
//Challenge 1
function cartPrice(items){
let totalCost =0;
for (let i =0; i< items.length; i++){
totalCost += items[i].price
}
return totalCost;
}
@Kash2910
Kash2910 / Bear.html
Created February 11, 2022 21:00
CSS frameworks: Common components and utilities
<!DOCTYPE html>
<html lang="en">
<head>
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
crossorigin="anonymous">
<!-- Required meta tags -->
<meta charset="utf-8" />
@Kash2910
Kash2910 / solution.js
Created February 10, 2022 22:47
Testing: Unit testing with Mocha and Chai
///////////Solution.js
function findStudentScoreByName(students, name) {
for (let person in students){
let item = students[person]
if (item.name === name){
return item.score
}
}
@Kash2910
Kash2910 / testtingAssignment.js
Created February 10, 2022 00:28
Testing Assignment
//Solution.js
function partitionStudentsByScore(students, score) {
const result = []
const target = []
const excess = []
students.forEach(student => {
student.score <= score ? target.push(student) : excess.push(student)
})
result.push(target, excess)
@Kash2910
Kash2910 / DataStructure.js
Created February 3, 2022 22:51
Data structures: Linked lists
////////////PArkingLot.js
const Queue = require("../queue/queue");
/**
* Implement a Parking Lot.
*
*/
class ParkingLot {
constructor(capacity, rate) {
this.spaces = new Array(capacity).fill("vacant");
@Kash2910
Kash2910 / Pomodoro.js
Created January 28, 2022 02:20
Pomodoro with separate components
//// PlayStop.js
import React from "react";
import classNames from "../utils/class-names";
function PlayStop ({ isTimerRunning, disableBtn, playPause, handleStop }) {
return (
<div className="row">
<div className="col">
<div
@Kash2910
Kash2910 / Binary.js
Created January 24, 2022 01:05
Data structures: Solving problems with stacks and queues
//Binary.js
const Queue = require("./lib/queue");
const binary = (max) => {
const array = ["1", "10", "11", "100", "101"]
return array.slice(0, max)
};
module.exports = binary;
function missing1(A) {
const N = A.length + 1
for ( let i = 1; i <= N; i++) {
let found = false
let j = 0
while (found === false && j < A.length) {
if (i === A[j]) {
found = true
}
j++
@Kash2910
Kash2910 / App.js
Created January 21, 2022 00:43
React with APIs and Hooks
//App.js
import React, { useEffect, useState } from "react"
import "./App.css"
import AlbumList from "./AlbumList"
import UserList from "./UserList"
function App() {
const [users, setUsers] = useState([])