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
exports.format = function(number, decimals, decSymbol, thousSymbol) { //number, decimal places , decimal symobl (.), thousands separator (,) | |
decimals = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals, | |
decSymbol = decSymbol == undefined ? "." : decSymbol, | |
thousSymbol = thousSymbol == undefined ? "," : thousSymbol, | |
posNegSymbol = number < 0 ? "-" : "", | |
i = parseInt(number = Math.abs(+number || 0).toFixed(decimals)) + "", | |
j = (j = i.length) > 3 ? j % 3 : 0; | |
return posNegSymbol + '$' + (j ? i.substr(0, j) + thousSymbol : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousSymbol) + (decimals ? decSymbol + Math.abs(number - i).toFixed(decimals).slice(2) : ""); | |
}; |
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
/* | |
* You Version Sample Event URL: http://bible.com/events/264769 | |
*/ | |
var sermonNoteURL = "youversion://events?id=" + eventID; //where eventID = 6 digit from YouVersion Event URL | |
openYouVersionSermonNotes(sermonNoteURL); | |
function openYouVersionSermonNotes(eventURL){ | |
if (OS_ANDROID){ | |
try { | |
var intent = Ti.Android.createIntent({ |
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
/* | |
The Android UI is provided via my Ti.Widget: ti.androidfingerprintalertdialog | |
https://github.com/adamtarmstrong/ti.androidfingerprintalertdialog | |
referenced in the code below as: $.androidFingerprint | |
*/ | |
function promptForTouchAuth(){ "use strict"; | |
if (OS_IOS) { | |
$.emailAddress.blur(); //hide keyboard before prompting for biometrics | |
TiTouchId.authenticate({ |
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
04f2a15dc90ddb1e9fcbe51c9450bf1a4655e7ffec0d7db4092d6b7633fc9ff8a126d12d53286a3a6e094eda60922b699fc1e708b888deef8581096773ccb653b3;m1ga |
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
//alloy.js | |
require("sqlite_reste_config"); | |
var localDB = require('sqlite_db'); | |
localDB.initDB(); | |
//sqlite_reste_config.js | |
Alloy.Globals.reste = require("reste"); |
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
/** | |
* token | |
* claim = "registered" || "public" || "private" | |
*/ | |
exports.decodeJWT = function(token, claim) { | |
var base64Url; | |
if (claim == "registered") { | |
base64Url = token.split('.')[0]; | |
} else if (claim == "private") { | |
base64Url = token.split('.')[2]; |
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
//var tiHelper = require('ti_helper'); | |
/* | |
* USAGE | |
* tiHelper.currency(numberToFormat,0); | |
*/ | |
exports.currency = function(number, decimals, decSymbol, thousSymbol) { //number, decimal places , decimal symobl (.), thousands separator (,) | |
decimals = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals, | |
decSymbol = decSymbol == undefined ? "." : decSymbol, |
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
/* | |
* Ti Modal BottomSheet - Fragment | |
* Sample/Screenshot - https://imgur.com/EPHd7D2 | |
*/ | |
/* | |
* USAGE WITHIN YOUR MAIN APP: | |
* Simply use: | |
* Alloy.createController("modalBottomsheet").getView().open(); |
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
//XML | |
<Alloy> | |
<SplitWindow id="splitWindow" backgroundColor="white" showMasterInPortrait="true" masterIsOverlayed="true" platform="ios"> | |
<!--MASTER--> | |
<NavigationWindow platform="ios"> | |
<Window title="Master" layout="vertical"> | |
<LeftNavButtons> | |
<Label id="masterCollapseButton" class="navButton" text="<<" onClick="toggleMaster" /> | |
</LeftNavButtons> | |
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
class ResultsObserver : NSObject, SNResultsObserving { //https://developer.apple.com/documentation/soundanalysis/analyzing_audio_to_classify_sounds | |
@ObjectBinding var whistle = Whistle() | |
func request(_ request: SNRequest, didProduce result: SNResult) { | |
... //removed for simplicity | |
if (classification.identifier == "my classification") { | |
print("Detected my classification - setting Object to true") //This shows in console (when appropriate) | |
DispatchQueue.main.async { | |
self.whistle.detected = true |
OlderNewer