Skip to content

Instantly share code, notes, and snippets.

View cirocosta's full-sized avatar

Ciro S. Costa cirocosta

View GitHub Profile
@cirocosta
cirocosta / broadcast_and_service.java
Created November 5, 2013 17:21
BroadcastReceiver e Service
public class MeuGcmBroadcastReceiver extends WakefulBroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// Explicitly specify that GcmIntentService will handle the intent.
ComponentName comp = new ComponentName(context.getPackageName(),
GcmIntentService.class.getName());
// Start the service, keeping the device awake while it is launching.
startWakefulService(context, (intent.setComponent(comp)));
setResultCode(Activity.RESULT_OK);
}
@cirocosta
cirocosta / ProcessaMensagem.java
Created November 5, 2013 17:23
Processa Mensagem
private void processaMensagem(Bundle extras){
if(extras.containsKey("message"){
String message = extras.getString("message");
sendNotification(message);
}
if(extras.containsKey("update"){
extras.getString("update");
SyncManager sync = new SyncManager(getApplicationContext());
sync.getUpdate();
@cirocosta
cirocosta / Base.md
Last active January 3, 2016 01:19
Open GUP

Open GUP

Crie seu treino.

Sobre

GymUP Aberto é o novo projeto da Aeho para criação e compartilhamento facilitado de treinos de academia. Busque treinos já criados por outros ou então crie o seu.

@cirocosta
cirocosta / SaveToDbFromClient.md
Created January 12, 2014 19:01
Adding elements to DB from ClientSide

How To

Como base, para evitar excesso de network signaling cliente --> servidor penso em utilizar do sessionStorage para salvamento temporário do conteúdo alí produzido pelo cliente. Quando terminado, clicado efetivamente em Salvar, envia-se o objeto para o webservice que então, em caso de resposta afirmativa o cliente é então avisado com o retorno do Id do objeto na database.

//TODO terminar

@cirocosta
cirocosta / RunningGaeLocally.md
Created January 12, 2014 19:46
Really short description on how to run a Gae w/ Python locally

Steps for running Gae Apps locally

Linux

  1. Download here the latest version of the Python version of GAE.
  2. Unzip everything on a folder.
  3. Create a MY_APPS directory at the root of the unzipped.
  4. git clone a repo on MY_APPS
@cirocosta
cirocosta / beta-testing.md
Last active January 3, 2016 15:09
A list of apps that are open for beta testing.
@cirocosta
cirocosta / DbPrebuilt.java
Created January 19, 2014 00:10
DbPrebuilt.java
public class DbPrebuilt extends SQLiteOpenHelper {
private static final String DB_PATH = "/data/data/my_package/databases/";
private static final String DB_NAME = "my_database_name.db";
private static final String DB_FULL_PATH = DB_PATH + DB_NAME;
private SQLiteDatabase mDatabase;
private final Context mContext;
public DbPrebuilt(Context context){
super(context, DB_NAME, null, 1);
this.mContext = context;
@cirocosta
cirocosta / Preloading Data Android.md
Last active January 3, 2016 17:59
A walkthrough preloading data - Andriod

Preloading Data - Android

There are basically 2 approaches:

  1. Setting a .db file and copying the file

  2. Setting a function to populate it and then assigning a value at SharedPreferences that holds the state (preferred).

With a .db

@cirocosta
cirocosta / running-epd-tests.md
Created February 14, 2014 17:08
Running endpoints-proto-datastore tests

A quick way for running endpoints-proto-datastore tests

  • download App Engine SDK to the root of the project.
  • create a virtualenv and then add the root of App Engine SDK to it
$ virtualenv .env
$ echo "$(pwd)/google_appengine" > .env/lib/python2.7/site-packages/gae.pth
@cirocosta
cirocosta / creating-user-mysql.md
Last active August 29, 2015 13:56
Creating a user with Mysql CLI

quick snippet for creating a user w/ mysql cli.

First, login and create a user:

$ mysql -u root_user -p
mysql > CREATE USER 'username'@'place' IDENTIFIED BY 'password';

then, grant privileges to it. The syntax is as follows: