Skip to content

Instantly share code, notes, and snippets.

View 19Site's full-sized avatar

Zell W. 19Site

View GitHub Profile
@19Site
19Site / Async.java
Created March 24, 2020 08:28
Async task helper, help you the async tasks one by one.
package com.example.lib;
import java.util.ArrayList;
import java.util.List;
/**
* Async task helper
* Help you the async tasks one by one
*
* @author 19Site
public static void main(String... args) {
AsyncTask<String, Integer, Boolean> task = new AsyncTask<String, Integer, Boolean>() {
// loading dialog
AlertDialog dialog = (new AlertDialog.Builder(context)).setCancelable(false).setMessage("loading").create();
@Override
protected Boolean doInBackground(String... strings) {
@19Site
19Site / get-days-of-month.js
Created January 22, 2020 11:59
Get days of month
/**
* get last date of month
*/
function getDaysOfMonth(year, month) {
// get date by month
switch (month) {
case 2:
@19Site
19Site / is-leap-year.js
Created January 22, 2020 11:58
Check is leap year
/**
* check year is leap year
*/
function isLeapYear(year) {
return ((year % 4) === 0 && (year % 100) !== 0) || (year % 400) === 0;
}
@19Site
19Site / is-leap-year.js
Last active January 22, 2020 11:55
Check year is leap year
'use strict';
function isLeapYear(year) {
// result
var result = undefined;
// set as today
if (typeof year === 'undefined') {