This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get last date of month | |
*/ | |
function getDaysOfMonth(year, month) { | |
// get date by month | |
switch (month) { | |
case 2: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* check year is leap year | |
*/ | |
function isLeapYear(year) { | |
return ((year % 4) === 0 && (year % 100) !== 0) || (year % 400) === 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function isLeapYear(year) { | |
// result | |
var result = undefined; | |
// set as today | |
if (typeof year === 'undefined') { |