Skip to content

Instantly share code, notes, and snippets.

@StefMa
StefMa / sendPushToGCMServer.php
Created May 20, 2015 10:54
Example of GCM-Server in PHP
<?php
// API access key from Google API's Console
// It's a Server-Key
define( 'API_ACCESS_KEY', 'YOUR_API_ACCESS_KEY' );
$registrationIds = array("DEVICE_REGISTRATION_IDS" );
// prep the bundle
$msg = array
(
@StefMa
StefMa / sendPushToGCMServer.py
Last active August 29, 2015 14:24
Example of GCM-Server in Python
try:
# Specify the url
url = 'https://android.googleapis.com/gcm/send'
# Setup the data to send
data = json.dumps({ "registration_ids" : [""+ USER_GCM_IDS +""], "data" : { "question" : data.question, "questionDetail" : data.questionDetail, "answerFormat" : data.answerFormat, "dateend" : str(data.dateend), "image" : data.image} })
# Add header
headers = {'Content-Type' : 'application/json', 'Authorization' : 'key=API_ACCESS_KEY'}
@StefMa
StefMa / README.md
Created July 8, 2015 11:04
TextInputLayoutWrapperView

TextInputLayoutWrapperView


What is it?

This is a simple wrapper View for the new TextInputLayout from Design Library.


Why?

Normaly you use the TextInputLayout like this

@StefMa
StefMa / README.md
Created July 24, 2015 14:26
SearchView suggestions over network

SearchView suggestions over network


What is it?

This is a simple how to make a network request with the SearchView implemented in a Toolbar.


Why?

The documentation for a Search Interface says that you can't make a a request over the network. You can only make a SearchView via recent searches or over a ContentProvider. I want to demonstrate how to make network request with the searchview.

@StefMa
StefMa / README.md
Last active August 29, 2015 14:26
FindView class to remove the ugly casting of Android Views

FindView helper class


What is it?

This is a simple helper class to casting the Views of your layout file in your Activity or Fragment.


Why?

Normally you get your layout Views like this:

@StefMa
StefMa / README.md
Created August 15, 2015 09:45
Deploy your android library to your ssh server with gradle

Deploy your Android library to your server with gradle


What is it?

This example shows you how to deploy your own Android library to your own server with gradle.


What do I need?

  • Webspace or Server with access over ssh (i.e. uberspace.de)
  • That's all
@StefMa
StefMa / README.md
Last active September 11, 2015 11:42
A simple Proxy Pattern in Java
@StefMa
StefMa / AndroidDevLinks.md
Last active March 24, 2017 08:06
Android Development Links
@StefMa
StefMa / converter.sh
Last active August 30, 2016 07:51
Simple PNG/JPG to WebP converter
images=($(find . -iname '*.png' -o -iname '*.jpg'))
for image in "${images[@]}"; do
webp_file_path="${image::${#image}-4}.webp"
echo "Convert ${image} to ${webp_file_path}"
$(./cwebp-5.1 -quiet "${image}" -o "${webp_file_path}")
rm "${image}"
done
@StefMa
StefMa / README.md
Last active September 20, 2016 17:11
StefDefault CodeStyle

StefDefault CodeStyle

My CodeStyle for IntelliJ and AS

####Default from AS 2.2

  • Field name prefix: m
  • Static field name prefix: s
  • Final local and parameters: true
  • Right margin: true (100) [Ensure right margin is not exceeded]
  • Keep getters & setters together