Skip to content

Instantly share code, notes, and snippets.

@dineshkp-dev
dineshkp-dev / App.js
Created January 1, 2020 10:25 — forked from koistya/App.js
How to add `onscroll` event in ReactJS component
import React from 'react';
let lastScrollY = 0;
let ticking = false;
class App extends React.Component {
componentDidMount() {
window.addEventListener('scroll', this.handleScroll, true);
}
@dineshkp-dev
dineshkp-dev / gist:2f64e476c6dd2bd8a3d6
Last active August 29, 2015 14:13
Servlet code for the login page.
package com.myshop.servlets;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@dineshkp-dev
dineshkp-dev / gist:7230d6ab136c982f46a6
Last active August 29, 2015 14:13
index 'Log-in' page for Dynamic Web Page
<!DOCTYPE html> <!-- Implies that this is a HTML5 Page! -->
<html>
<head>
<meta charset="ISO-8859-1">
<!-- The below line shows the 'title' for the page, it should be placed within the '<head></head>' tags -->
<title>Welcome to the My Shopping Page</title>
</head>
<!-- The below is the body of our HTML page -->
<body>
<h1 align="center">Please log-in to the Shopping site</h1>
@dineshkp-dev
dineshkp-dev / all_branches.sh
Last active August 29, 2015 14:08
Shell script to create and track all the remote branches for a Repository's clone
#!/bin/bash
for eachbranch in $(git branch -a | grep remotes | grep -v HEAD | grep -v master | awk -F/ '{print $3}');
do
git branch $eachbranch --track remotes/origin/$eachbranch;
done