Skip to content

Instantly share code, notes, and snippets.

Working from home

pradeep singh pradeep1991singh

Working from home
View GitHub Profile
View .zshrc
# git aliases
alias st='git status'
alias co='git checkout'
alias pl='git pull'
alias pu='git push'
alias plr='git pull --rebase'
alias plro='git pull --rebase origin'
alias lg='git log'
alias ga='git add .'
alias ci='git commit'
View CSS and HTML interview


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() {
// 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 / 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]-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
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; = next;
this.prev = prev;
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:
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 / SortableList.html
Last active Sep 3, 2020
SortableList support drag-drop feature
View SortableList.html
<!DOCTYPE html>
<div id="list"></div>
View gist:628cc748c7fcf3e8d76bbe38cbaf2e37