Skip to content

Instantly share code, notes, and snippets.

View Singhak's full-sized avatar

Anil Singh Singhak

View GitHub Profile
@Singhak
Singhak / index.html
Created December 28, 2023 17:25
innertext vs innerhtml vs textcontent
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="innertext"></div>
<div id="innerhtml"></div>
let startDate = new Date("2010-05-28");
let endDate = new Date("2020-03-01");
function isDateValid(dateToCheck) {
return isNaN(Date.parse(dateToCheck)) ? false : true;
}
function getMilliSecDiff(startDate, endDate) {
let startMilliSec = startDate.getTime();
let endMilliSec = endDate.getTime();
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Cross-Browser QRCode generator for Javascript</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
<script type="text/javascript" src="jquery.min.js"></script>
<!-- Download from https://github.com/davidshimjs/qrcodejs/zipball/master -->
<script type="text/javascript" src="qrcode.js"></script>
</head>
<html>
<head>
<style>
.full-circle {
width: 300px;
height: 300px;
border-radius: 150px 150px 150px 150px;
background-color: red;
}
# need to import ABCMeta, abstractmethod from abc (abstract base classes) module to implement abstract class feature
from abc import ABCMeta, abstractmethod
# we required (metaclass = ABCMeta) to use feature of abstraction
class Shape(metaclass = ABCMeta):
#To tell python this is abstractmethod we have to use A decorator indicating abstract methods.
@abstractmethod
def area(self):
pass
@Singhak
Singhak / GradleExec.gradle
Last active April 10, 2023 02:18
Example of gradle task exec
// First way
task SvnDiif {
new ByteArrayOutputStream().withStream { os ->
exec {
executable = 'svn'
args = ['diff', '-r', "reviosionNo_from:revisionNo_to", "svn_repo", '--summarize']
standardOutput = os
}
def outputAsString = os.toString()
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.admin.tabhostwithfragment.FragmentA">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Fragment B" />
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.admin.tabhostwithfragment.FragmentA">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Fragment A" />
@Singhak
Singhak / fragment_tab_host.xml
Created June 21, 2016 05:11
This is use to host fragment
<android.support.v4.app.FragmentTabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
@Singhak
Singhak / activity_main.xml
Created June 21, 2016 05:10
This is used in MainActivity
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:id="@+id/relative_layout"