This file contains 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
# File-desc: Hijri - Gregorian date converter (Umm al-Qurra) | |
# Dep: | |
# Ref: 1) https://github.com/tytkal/python-hijiri-ummalqura | |
# 2) http://www.staff.science.uu.nl/~gent0113/islam/ummalqura.htm | |
# 3) http://keith-wood.name/calendars.html | |
# --------------------------------------- | |
import math | |
def tohijri(year, month, day): |
This file contains 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
from script import t, r, topic, end, tpl | |
tpl('no_answer', ['I cannot answer that yet', 'I don\' have answer for that']) | |
tpl('no_answer', ['Saya tak ada jawapan buat masa ini', 'Saya tiada maklumat tersebut'], 'ms') | |
t('cancel') | |
r('Let\'s move on, anything else i can help? ', fun='cancel_topic') | |
t('batal') | |
r('Baiklah, apa lagi yang boleh saya bantu?', fun='cancel_topic') |
This file contains 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
import os | |
import requests | |
from requests_toolbelt import MultipartEncoder | |
def send_attachment(page_token, recipient_id, filetype, path): # filetype = image, audio, video, file | |
payload = { | |
'recipient':{ | |
{ 'id':recipient_id } | |
}, | |
'message':{ |
This file contains 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
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.util.AttributeSet; | |
import android.widget.EditText; | |
import android.os.Build; | |
import android.support.v7.internal.widget.TintTypedArray; | |
public class EditTextEx extends EditText { |
This file contains 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
/* Storage access check */ | |
public static boolean isExternalStorageWritable() { | |
String state = Environment.getExternalStorageState(); | |
if (Environment.MEDIA_MOUNTED.equals(state)) return true; | |
return false; | |
} | |
public static boolean isExternalStorageReadable() { | |
String state = Environment.getExternalStorageState(); |
This file contains 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
/* | |
Source -> http://www.michenux.net/android-database-sqlite-creation-upgrade-245.html | |
- make sql file like below and save inside /assets/sql/ | |
Create: mydb-create.sql | |
Upgrades: mydb-upgrade-101.sql, mydb-upgrade-102.sql | |
Do Not Edit (unless you know what you're doing) | |
*/ |
This file contains 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
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.util.AttributeSet; | |
import android.support.v7.widget.RecyclerView; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.view.View; | |
import android.graphics.Rect; | |
import android.graphics.drawable.Drawable; | |
import android.graphics.Canvas; |
This file contains 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
/* | |
Makkah Calendar | |
http://www.makkahcalendar.org/en/hijriCalendar.php | |
Usage: String today = MakkahCalendar.getSimpleDate(null); | |
*/ | |
import java.util.Calendar; | |
public final class MakkahCalendar { |
This file contains 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
/* | |
Umm Al-Qura Islamic Calendar | |
valid from 1356 AH (14 March 1937 CE) to 1500 AH (16 November 2077 CE). | |
Outside this interval, the converter will give erroneous results. | |
ported from javascript from: | |
http://www.staff.science.uu.nl/~gent0113/islam/ummalqura_converter.htm#top | |
*/ | |
import java.util.Calendar; |