Skip to content

Instantly share code, notes, and snippets.

View caspahouzer's full-sized avatar

Sebastian Klaus caspahouzer

View GitHub Profile
@caspahouzer
caspahouzer / incidence-vaccines-scriptable.js
Last active May 14, 2021 07:06 — forked from dwd0tcom/incidence-vaccines-scriptable.js
A scriptable widget to display and show the current incidence and vaccine status.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-gray; icon-glyph: magic;
// Licence: Robert Koch-Institut (RKI), dl-de/by-2-0
// Vaccine API by @_ThisIsBenny_
// Define URLs based on the corona.rki.de webpage
const newCasesApiUrl = `https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?f=json&where=NeuerFall%20IN(1%2C%20-1)&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22AnzahlFall%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&resultType=standard&cacheHint=true`;
const incidenceUrl = (location) =>
@caspahouzer
caspahouzer / Usage description
Last active January 28, 2016 07:45
Used for native functions within webviews in Appcelerator
Funktionen
openWindow
<a href="https://www.test.de/subpage.html" data-action="openWindow">Neues natives Fenster mit URL öffnen</a>
oder
<a href="#" data-action="openWindow" data-url="https://www.test.de/subpage.html">Neues natives Fenster mit URL öffnen</a>
Das data-action Attribut ist an dieser Stelle optional, da generell ALLE Urls erstmal über openWindow aufgerufen werden.
Optionale Parameter:
$(document).ready(function() {
var zoomed = false;
$( "#container" ).dblclick(function() {
if(zoomed === false){
$("body").css('transition', '');
$("body").css('zoom', 2);
$("body").css('-moz-transform', 'scale(2)');
$("body").css('-ms-transform', 'scale(2)');
zoomed = true;
}else{
String.prototype.printf = function (obj) {
var useArguments = false;
var _arguments = arguments;
var i = -1;
if (typeof _arguments[0] == "string") {
useArguments = true;
}
if (obj instanceof Array || useArguments) {
return this.replace(/\%s/g, function (a, b) {
i++;
@caspahouzer
caspahouzer / gist:a4d0f0093a9110ac8913
Created December 17, 2014 12:44
download file and save to private ios directory
function getFileAndSave (filename, url) {
var file_obj = {
file: filename,
url: url,
path: null
};
var testFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory);
var privateDocFolder = testFile.nativePath.replace('Documents/', '');
privateDocFolder += 'Library/Private%20Documents/';