Skip to content

Instantly share code, notes, and snippets.

View maxkatz's full-sized avatar

Max Katz maxkatz

View GitHub Profile
// API URL
var url = "https://gateway.watsonplatform.net/language-translator/api/v2/translate";
// Optional parameters
var text = request.get("text") || "Hello";
var source = request.get("source") || "en";
var target = request.get("target") || "es";
// Credentials
var username = "Username from service credentials";
@maxkatz
maxkatz / online-offline.js
Last active February 13, 2016 19:22
Check if Appery.io app is online or offline
// Check online or offline
Apperyio.get("AppClientGeneralOperations").getState().then(function(state) {
if (state === "online")
$scope.appState = true;
else
$scope.appState = false;
console.log(state);
});
@maxkatz
maxkatz / NativeAPIsWebinar_April29_2015
Last active August 29, 2015 14:20
Code for Native APIs Webinar - April 29, 2015
// Alert
navigator.notification.alert(
'Build apps fast with Appery.io',
alertDismissed,
'My App',
'Got it.'
);
function alertDismissed () {
alert ("Nice - that worked");
@maxkatz
maxkatz / gist:440fd4e4db679e32ffb7
Created February 25, 2015 23:26
Appery.io Video Training Course
***Custom CSS
.ui-btn {
font-weight:bold;
font-size:24px;
}
// use the 'id'
element.on("click", function () {
Apperyio.storage.<variable_name>.set(value.id);
});
// use the whole object
element.on("click", function () {
Apperyio.storage.<variable_name>.set(value.);
});
cordova.define("nl.xservices.plugins.Toast", function(require, exports, module) {
function Toast() {}
Toast.prototype.show = function(message, duration, position, successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "Toast", "show", [message, duration, position]);
};
Toast.prototype.showShortTop = function(message, successCallback, errorCallback) {
this.show(message, "short", "top", successCallback, errorCallback);
{
"file": "plugins/nl.xservices.plugins/www/Toast.js",
"id": "nl.xservices.plugins.Toast",
"clobbers": ["ToastPlugin"]
}
<feature name="Toast">
@maxkatz
maxkatz / Toast plugin sample app
Created November 4, 2014 21:45
Toast plugin sample app
var message = Apperyio("message").val();
var duration = Apperyio("duration").val();
var position = Apperyio("position").val();
ToastPlugin.show(message, duration, position);
{
"delay": "false",
"IATA": "IAD",
"state": "District of Columbia",
"name": "Washington Dulles International",
"weather": {
"visibility": 4,
"weather": "Light Rain Fog/Mist",
"meta": {
"credit": "NOAA's National Weather Service",
SOA login URL:
https://p0st3r.eap.soa.com/oauth/auz/authorize
Airport service URL:
https://p0st3r.broker.soa.com:443/v6/faa/airport/status/{airportCode}