Skip to content

Instantly share code, notes, and snippets.

View ursimon's full-sized avatar

Michal Ursiny ursimon

View GitHub Profile
@ursimon
ursimon / launchMap.java
Created February 10, 2014 09:44
Launch google map w/ marker
/**
* starts google maps w/ lat lon
*/
public static void showOnMap(Context c, double lat, double lng, String name) {
String geoUri = "geo:"+lat+","+lng+"?q="+lat+","+lng+"("+name+")";
Uri geo = Uri.parse(geoUri);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(geo);
intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
if (intent.resolveActivity(c.getPackageManager()) != null) {
@ursimon
ursimon / gist:9249338
Created February 27, 2014 12:43
Imagick batch convert command line (from tif->png)
for f in *.tif; do convert $f $(basename $f .tif).png;done
@ursimon
ursimon / gist:9250309
Created February 27, 2014 13:47
Imagick quickly resize
for f in *.png; do convert $f -resize 400x210 $(basename $f .png).png;done
@ursimon
ursimon / LayoutTransition.CHANGING
Created July 28, 2014 11:29
Setting layout transitions for changes ANDROID
if (Build.VERSION.SDK_INT>=16) { // this is only for Jelly Bean and up
LinearLayout container = (LinearLayout) getView().findViewById(R.id.container);
LayoutTransition transition = container.getLayoutTransition();
transition.enableTransitionType(LayoutTransition.CHANGING);
}
@ursimon
ursimon / gist:6376225
Created August 29, 2013 09:53
GoogleMapsAPIforBusinessURLHelper for Android ready to use class convert your standard googleapis request to business ones; call signURL returns url with client + signature attached
package com.whateverpackage.util;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
@ursimon
ursimon / autoincrement.py
Created October 9, 2013 15:23
python script to auto-increment AndroidManifest.xml versionName + versionCode
#!/usr/bin/python
from xml.dom.minidom import parse
dom1 = parse("AndroidManifest.xml")
oldVersion = dom1.documentElement.getAttribute("android:versionName")
oldVersionCode = dom1.documentElement.getAttribute("android:versionCode")
versionNumbers = oldVersion.split('.')
versionNumbers[-1] = unicode(int(versionNumbers[-1]) + 1)
dom1.documentElement.setAttribute("android:versionName", u'.'.join(versionNumbers))
@ursimon
ursimon / filter by log tag
Created October 9, 2013 15:18
filter out dalvik regexp from eclipse
^(?!.*(dalvik)).*$
@ursimon
ursimon / GsonRequestHeaders.java
Created December 2, 2013 00:42
GsonRequest w/ support for headers and body
/**
* Copyright 2013 Ognyan Bankov
* modified by Michal Ursiny for purposes of Fuerte Eshop adding headers and body support
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@ursimon
ursimon / openweb.java
Created January 17, 2014 14:33
Open Web Url Intent
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);