Skip to content

Instantly share code, notes, and snippets.

View rashid327's full-sized avatar

Rashid ALi rashid327

  • TekFocal
  • Lahore
View GitHub Profile
@rashid327
rashid327 / states-of-pakistan
Created February 12, 2020 11:20
Pakistan States dropdown
<!-- States of Pakistan -->
<select>
<option value="1">FATA</option>
<option value="2">Balochistan</option>
<option value="3">Khyber Pakhtunkhwa</option>
<option value="4">Punjab</option>
<option value="5">Sindh</option>
<option value="6">Azad Kashmir</option>
<option value="7">Gilgit-Baltistan</option>
<input placeholder="Date" class="dateDO" type="text" onfocus="(this.type='date')" id="date">
@rashid327
rashid327 / date-onfocus-js
Last active February 12, 2020 11:55
onfocus Date in JS
<!-- Date onfocus in java script -->
<input placeholder="Date" class="dateDO" type="text" onfocus="(this.type='date')" id="date">
@rashid327
rashid327 / states-of-india
Last active April 19, 2024 15:59
Indian States dropdown HTML
<!-- States of India -->
<select>
<option value="AP">Andhra Pradesh</option>
<option value="AR">Arunachal Pradesh</option>
<option value="AS">Assam</option>
<option value="BR">Bihar</option>
<option value="CT">Chhattisgarh</option>
<option value="GA">Gujarat</option>
<option value="HR">Haryana</option>
@rashid327
rashid327 / add 24 hours to date
Created February 14, 2020 10:41
add 24 hours to date
new Date(new Date(myStringDate).getTime() + 60 * 60 * 24 * 1000);
@rashid327
rashid327 / Angular 6, Part 3: Lifecycle of a Component
Created February 17, 2020 06:37
Angular 6: Lifecycle of a Component
In this article, we will discuss the lifecycle of components. Since, in Angular, a component is the main building block the application, it is very important for us to understand the lifecycle processing steps of the components so that we can implement that in our applications.
Lifecycle Method
In Angular, every component has a life-cycle, a number of different stages it goes through. There are 8 different stages in the component lifecycle. Every stage is called as lifecycle hook event. So, we can use these hook events in different phases of our application to obtain control of the components. Since a component is a TypeScript class, every component must have a constructor method. The constructor of the component class executes, first, before the execution of any other lifecycle hook events. If we need to inject any dependencies into the component, then the constructor is the best place to inject those dependencies. After executing the constructor, Angular executes its lifecycle hook methods in a specific or
@rashid327
rashid327 / AJAX Request
Last active February 17, 2020 06:42
AJAX is not a programming language. AJAX is a technique for accessing web servers from a web page. AJAX stands for Asynchronous JavaScript And XML.
<!DOCTYPE html>
<html>
<body>
<div id="demo">
<h2>The XMLHttpRequest Object</h2>
<button type="button" onclick="loadDoc()">Change Content</button>
</div>
<script>
@rashid327
rashid327 / JQuery Date Picker example to disable previous dates
Last active February 18, 2020 09:24
JQuery Date Picker example to disable previous dates
<html>
<head>
<title></title>
<link href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" rel="Stylesheet"
type="text/css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script language="javascript">
$(document).ready(function () {
$("#txtdate").datepicker({
@rashid327
rashid327 / javaScript localStorage
Created February 18, 2020 13:34
javaScript localStorage
// set data on localstorage
localStorage.setItem("username", "admin");
// get data from localstorage
localStorage.getItem("username");
@rashid327
rashid327 / Array.prototype.forEach()
Created February 26, 2020 05:45
Array.prototype.forEach()
const array1 = ['a', 'b', 'c'];
array1.forEach(element => console.log(element));
// expected output: "a"
// expected output: "b"
// expected output: "c"