Skip to content

Instantly share code, notes, and snippets.

4 + 3
4.0 - 3
5 / 3
4 and 5
AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
asyncHttpClient.prepareGet("http://hsasolutions.cloudapp.net/OptiCompraWS/OptiC/B/Opticompra.asmx/EntregaPrecios?pIdMuni=0&id_prod=339&pos_lat=0&pos_lon=0&Login_app=0&Password_app=0&pVers=0&pRadio=0").execute(new AsyncCompletionHandler(){
@Override
public Response onCompleted(Response response) throws Exception{
// Do something with the Response
// ... `
return response;
}
@ajamaica
ajamaica / activity.java
Created February 5, 2015 19:29
giro android
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
setContentView(R.layout.activity_splash);
}
else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
setContentView(R.layout.activity_splash);
static NSString *identifier = @"RoutePinAnnotation";
MKPinAnnotationView* pinView = [[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:identifier] ;
pinView.animatesDrop=YES;
pinView.canShowCallout=YES;
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton setTitle:annotation.title forState:UIControlStateNormal];
[rightButton addTarget:self
@ajamaica
ajamaica / gist:9223276
Created February 26, 2014 03:59
keybase.md
### Keybase proof
I hereby claim:
* I am ajamaica on github.
* I am ajamaica (https://keybase.io/ajamaica) on keybase.
* I have a public key whose fingerprint is 837F 8E4A E1F3 EE73 C607 5CDE 2457 0258 D560 8A08
To claim this, I am signing this object:
@ajamaica
ajamaica / async
Last active December 27, 2015 19:39
AsyncTask de Jsonusonew MinutoMinAsync().execute("http://www.copalive.com/api/json/match/live/"+ c.espn_id +"?l=es");
HTTPAsync().execute("http://www.copalive.com/api/json/match/live/");
private class HTTPAsync extends AsyncTask<String, Void, String> {
InputStream is = null;
String json = "";
@Override
protected String doInBackground(String... urls) {
// Making HTTP request
@ajamaica
ajamaica / gist:7375558
Created November 8, 2013 18:42
Query de App Engine en Python a dict para json. Después solo usa json.
def gql_json_parser(query_obj):
result = []
for entry in query_obj:
result.append(dict([(p, unescape(unicode(getattr(entry, p)))) for p in entry.properties()]))
return result
@ajamaica
ajamaica / gist:7201923
Created October 28, 2013 18:23
Adapter
package mx.com.estrategiatec.TDU.Adapters;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
@ajamaica
ajamaica / gist:7201890
Created October 28, 2013 18:21
lista con parse
/**
*
*/
package mx.com.estrategiatec.TDU;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.preference.PreferenceManager;
@ajamaica
ajamaica / gist:5893344
Created June 30, 2013 01:03
UIInterpolatingMotionEffect
UIInterpolatingMotionEffect *mx = [[UIInterpolatingMotionEffect alloc]
initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
mx.maximumRelativeValue = @-39.0;
mx.minimumRelativeValue = @39.0;
UIInterpolatingMotionEffect *mx2 = [[UIInterpolatingMotionEffect alloc]
initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
mx2.maximumRelativeValue = @-39.0;
mx2.minimumRelativeValue = @39.0;