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
if(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement) { | |
//in fullscreen, so exit it | |
alert('exit fullscreen'); | |
if(document.exitFullscreen) { | |
document.exitFullscreen(); | |
} else if(document.msExitFullscreen) { | |
document.msExitFullscreen(); | |
} else if(document.mozCancelFullScreen) { | |
document.mozCancelFullScreen(); | |
} else if(document.webkitExitFullscreen) { |
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
/** | |
* THIS UTILITY CLASS | |
* HELPS DISPLAY DATEPICKER DIALOG on ANY UI-ELEMENT "onClick". | |
* @params EditText, Context | |
* | |
* @apiNote Example: on a button: Just place this line in your activity's onCreate: | |
* new SetDateDialog(btnName, ActivityName.this); | |
* | |
*/ | |
public class SetDateDialog implements View.OnClickListener, DatePickerDialog.OnDateSetListener { |
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.app.Activity; | |
import android.content.res.Configuration; | |
import android.content.res.Resources; | |
import android.os.Build; | |
import java.util.Locale; | |
/** | |
* Language Manager. | |
* Changing the global display Language of your App |
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
/** | |
* For auto-adjusting ListView height | |
* @see "https://stackoverflow.com/a/28713754" | |
*/ | |
public class ListUtils { | |
public static void setDynamicHeight(ListView mListView) { | |
ListAdapter mListAdapter = mListView.getAdapter(); | |
if (mListAdapter == null) { | |
// when adapter is null | |
return; |
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
public class InverseCompare { | |
public static final String ID = "id"; | |
public static final String ANIMALNAME = "animalName"; | |
public static void main(String[] args) { | |
ArrayList<Map<String, Object>> myList = new ArrayList<>(4); // what we have now. | |
Map<String, Object> map0 = new HashMap<>(); | |
Map<String, Object> map1 = new HashMap<>(); |
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
/** | |
* FOrces Sunday as first day of week. | |
* | |
* @param date given date | |
* @return First day of this day's week | |
*/ | |
public static Date getFirstDayofWeek(@NotNull Date date) { | |
Calendar cal = Calendar.getInstance(); | |
cal.setTime(date); | |
int currentDay = cal.get(Calendar.DAY_OF_WEEK); |
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
const axios = require("axios").default; | |
//CLOUD function for getting calories for given `foodName` | |
Parse.Cloud.define("getcalories", async(request) => { | |
const foodName = request.params.foodName; | |
const options = { | |
method: "GET", | |
url: "https://api.calorieninjas.com/v1/nutrition", | |
params: { query: foodName }, | |
headers: { |
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
<?php | |
//this simple example uses MYSQLi to upload an PHOTO file to an SQL database. | |
//modify the HTML part as you wish to make it prettier OR ADD MORE inputs fields. | |
/* USE this for PHOTO uploads ONLY. WON'T work with PDF, DOC etc. */ | |
// ALSO, do not ignore escaping strings or using PREpared statements for security. | |
mysqli_report( MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT ); | |
$conn = mysqli_connect( $HOSTNAME, $DB_USERNAME, $DB_PASSWORD, "_YOUR_DB_NAME_HERE" ); |
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
/* FINAL FINAL FINAL*/ | |
// UPLOAD THIS CODE IN your BACK4APP CLOUD CONSOLE. | |
//LAST UPDATED 30.12.2020 | |
// Requiring npm module | |
const braintree = require("braintree"); | |
// Initializing gateway | |
const gateway = new braintree.BraintreeGateway({ | |
environment: braintree.Environment.Sandbox, |