Skip to content

Instantly share code, notes, and snippets.

Avatar

pradeep singh pradeep1991singh

View GitHub Profile
View CSS and HTML interview questions.md

CSS


What is CSS?

  • CSS stands for Cascading Style Sheet.
  • Styles define how to display HTML elements
  • Styles were added to HTML 4.0 to solve a problem
  • External Style Sheets can save a lot of work
  • External Style Sheets are stored in CSS files
View kanban-board.js
import React, { Component } from 'react';
import './index.css';
export default class KanbanBoard extends Component {
constructor() {
super();
// Each task is uniquely identified by its name.
// Therefore, when you perform any operation on tasks, make sure you pick tasks by names (primary key) instead of any kind of index or any other attribute.
this.state = {
tasks: [
@pradeep1991singh
pradeep1991singh / rain-water-trapped.js
Last active Aug 13, 2020
Rain water trapped problem
View rain-water-trapped.js
// The idea is to use two pointer technique, pointer i & j for optimal solution
// run time complexity O(N)
// space time complexity O(1)
function trappedWater(height) {
if (height < 3) return 0;
// initialize trappedWater to zero
let trappedWater = 0;
View sieve-of-eratosthenes.html
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
@pradeep1991singh
pradeep1991singh / lru.js
Created Nov 10, 2019 — forked from udayvunnam/lru.js
least recently used cache, lru
View lru.js
class Node {
constructor(key, value, next = null, prev = null) {
this.key = key;
this.value = value;
this.next = next;
this.prev = prev;
}
}
@pradeep1991singh
pradeep1991singh / tim.js
Created Nov 9, 2019 — forked from premasagar/tim.js
A tiny, secure JavaScript micro-templating script. It doesn't use eval or (new Function), so it cannot execute malicious code.
View tim.js
/*
== Tim ==
A tiny, secure JavaScript micro-templating script.
This has now moved to:
github.com/premasagar/tim
*/
View beacon.js
// URL to send the data to
let url = '/api/my-endpoint';
// Create a new FormData and add a key/value pair
let data = new FormData();
data.append('hello', 'world');
let result = navigator.sendBeacon(url, data);
if (result) {
@pradeep1991singh
pradeep1991singh / SortableList.html
Last active Sep 3, 2020
SortableList support drag-drop feature
View SortableList.html
<!DOCTYPE html>
<html>
<head>
<title>Sortable</title>
</head>
<body>
<div id="list"></div>
View gist:628cc748c7fcf3e8d76bbe38cbaf2e37
Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
View gist:09fcabe7159d2710aedcc9fbe2035500
Afghanistan
Albania
Algeria
Andorra
Angola
Anguilla
Antigua & Barbuda
Argentina
Armenia
Australia
You can’t perform that action at this time.