Skip to content

Instantly share code, notes, and snippets.

View thomasbrueggemann's full-sized avatar
👨‍💻

Thomas Brüggemann thomasbrueggemann

👨‍💻
View GitHub Profile
@thomasbrueggemann
thomasbrueggemann / config.xml
Last active August 29, 2015 14:17
config.xml for PhoneGap Splash Screens generated by http://ticons.fokkezb.nl/
<widget>
<gap:splash src="www/res/splash/android/res-long-port-ldpi/default.png" density="port-ldpi"/>
<gap:splash src="www/res/splash/android/res-long-port-mdpi/default.png" density="port-mdpi"/>
<gap:splash src="www/res/splash/android/res-long-port-hdpi/default.png" density="port-hdpi"/>
<gap:splash src="www/res/splash/android/res-long-port-xhdpi/default.png" density="port-xhdpi"/>
<gap:splash src="www/res/splash/android/res-long-port-xxhdpi/default.png" density="port-xxhdpi"/>
<gap:splash src="www/res/splash/android/res-long-port-xxxhdpi/default.png" density="port-xxxhdpi"/>
<gap:splash gap:platform="ios" height="480" width="320" src="www/res/splash/ios/Default.png" />
<gap:splash gap:platform="ios" height="960" width="640" src="www/res/splash/ios/Default@2x.png" />
@thomasbrueggemann
thomasbrueggemann / config.xml
Last active March 10, 2018 10:57
Phonegap Config for Icons imported from http://makeappicon.com/
<widget>
<icon gap:platform="android" gap:qualifier="ldpi" src="www/res/icon/android/drawable-ldpi/ic_launcher.png" />
<icon gap:platform="android" gap:qualifier="mdpi" src="www/res/icon/android/drawable-mdpi/ic_launcher.png" />
<icon gap:platform="android" gap:qualifier="hdpi" src="www/res/icon/android/drawable-hdpi/ic_launcher.png" />
<icon gap:platform="android" gap:qualifier="xhdpi" src="www/res/icon/android/drawable-xhdpi/ic_launcher.png" />
<icon gap:platform="android" gap:qualifier="xxhdpi" src="www/res/icon/android/drawable-xxhdpi/ic_launcher.png" />
<icon gap:platform="android" gap:qualifier="xxxhdpi" src="www/res/icon/android/drawable-xxxhdpi/ic_launcher.png" />
<icon gap:platform="ios" height="29" src="www/res/icon/ios/Icon-Small.png" width="29" />
<icon gap:platform="ios" height="58" src="www/res/icon/ios/Icon-Small@2x.png" width="58" />
@thomasbrueggemann
thomasbrueggemann / localStorage.Object.js
Last active August 29, 2015 14:17
Objects in localStorage via setObject(k, v, ttl) / getObject(k,v) and optional TTL values
Storage.prototype.setObject = function(key, value, ttl) {
this.setItem(key, JSON.stringify(value));
if(ttl) {
this.setItem(key + "~ttl", moment.utc().add(ttl, "seconds").format("X"));
}
};
Storage.prototype.getObject = function(key) {
var value = this.getItem(key);
@thomasbrueggemann
thomasbrueggemann / PullToRefresh.mm
Created June 6, 2013 08:14
A simple pull-to-refresh for UIScrollViews. Whenever the UIScrollView ist pulled into a minus offset range auf at least -80, a reload method is triggered. But only if the scroll offset was in a range >= 0 before. This avoids infinite loading loops.
- (void)scrollViewDidScroll:(UIScrollView *)sender
{
if (sender.contentOffset.y >= 0)
{
self.inZero = YES;
}
// if the user pulled into abyss ...
if (sender.contentOffset.y <= -80 && inZero == YES)
{
@thomasbrueggemann
thomasbrueggemann / arbeit.tex
Last active December 14, 2015 10:58
Universität zu Köln - Lehrstuhl Mellis/Sunyaev - BibLaTeX Zitationsstil (inoffiziell)
% ...
% Literaturverzeichnis
\usepackage[
bibstyle=authortitle, % in Verzeichnis das Jahr nicht hinter Autoren anzeigen
citestyle=authoryear, % in Fussnote das Jahr mit anzeigen
isbn=false, % keine ISBN-Nummer
url=false, % keine URLs
doi=false, % keine DOI
maxcitenames=1, % nur einen Autor in Fussnote anzeigen
<?
$to = "test@test.de";
$from = "test@test.de";
$subject = "Hallo Test";
$message = "<html>...</html>";
// to send the HTML mail, set the Content-type header
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
@thomasbrueggemann
thomasbrueggemann / sinus_sleeper.py
Last active December 11, 2015 09:48
Distributes the sleeping time of a script over the 24 hours of a day, so that at the zenith the max_time will be waited and 12 hours later 1 second will be waited. That gives to opportunity to set the zenit to the hour of the day that to least traffic will be expected (e.g. 3am). This could be interesting to any kind of long running scripts that…
from datetime import datetime
import math, time
#
# SINUS SLEEPER
#
# max_time: maximum seconds to sleep at the zenith hour
# zenith : hour (0-23) of day at which the max_time value is reached
#
def sinus_sleeper(max_time=120, zenith=0):