Skip to content

Instantly share code, notes, and snippets.

View m4scosta's full-sized avatar

Marcos Costa Pinto m4scosta

  • São José dos Campos, São Paulo
  • 08:25 (UTC -03:00)
View GitHub Profile
@m4scosta
m4scosta / PushNotification.java
Created August 11, 2016 02:34
Android push notification using Parse Cloud Code
String installationId = "INSTALLATION_ID"; // replace with correct installationId
Map<String, String> data = new HashMap<String, String>();
data.put("alert", "Hello there!"); // replace with correct message
Map<String, Object> params = new HashMap<String, Object>();
params.put("installationId", installationId);
params.put("data", data);
ParseCloud.callFunctionInBackground("push", params, new FunctionCallback<Object>() {
@m4scosta
m4scosta / AppBaseActivity.java
Created September 1, 2016 01:40
Android: Easiest way to reuse a common Navigation drawer among a group of activities.
/*
* This is a simple and easy approach to reuse the same
* navigation drawer on your other activities. Just create
* a base layout that conains a DrawerLayout, the
* navigation drawer and a FrameLayout to hold your
* content view. All you have to do is to extend your
* activities from this class to set that navigation
* drawer. Happy hacking :)
* P.S: You don't need to declare this Activity in the
* AndroidManifest.xml. This is just a base class.
/* Demonstrates the Goldbach's conjecture - Every even integer greater than 2 can be expressed as the sum of two primes
*
* author: Igor Hercowitz
*
* usage: java Goldbach <number>
* output: the sum of the primes list
*
* ex:
* > java Goldbach 100
* 100 can be writen as: [97+3, 89+11, 83+17, 71+29, 59+41, 53+47]