Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright (C) 2006 The Android Open Source Project
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
@ignaciogs
ignaciogs / gist:4038911
Created November 8, 2012 13:50
Returns conditions from World Weather Online API for a given latitude and longitude
GeoPoint center = mapView.getMapCenter();
WorldWeatherOnlineApiProvider.getClient().query(new ContextAwareAPIDelegate<WorldWeatherOnlineResponse>(MainActivity.this,
WorldWeatherOnlineResponse.class, RequestCache.LoadPolicy.NEVER, RequestCache.StoragePolicy.DISABLED) {
@Override
public void onResults(WorldWeatherOnlineResponse worldWeatherOnlineResponse) {
}
@Override
public void onError(Throwable e) {
@ignaciogs
ignaciogs / gist:4038861
Created November 8, 2012 13:42
Returns conditions (the current temperature, weather condition, humidity, wind, 'feels like' temperature, barometric pressure, and visibility from Weather Underground's Weather API) for a given latitude and longitude
GeoPoint center = mapView.getMapCenter();
WundergroundApiProvider.getClient().query(new ContextAwareAPIDelegate<WundergroundResponse>(MainActivity.this, WundergroundResponse.class, RequestCache.LoadPolicy.NEVER) {
@Override
public void onResults(WundergroundResponse wundergroundResponse) {
Toast.makeText(MyActivity.this, wundergroundResponse.getCurrentObservation().getWeather(), Toast.LENGTH_LONG).show();
}
@Override
public void onError(Throwable e) {
Toast.makeText(MyActivity.this, "fail", Toast.LENGTH_LONG).show();
}
@ignaciogs
ignaciogs / convertLocalizable.rb
Created October 31, 2012 14:38 — forked from florianmski/convertLocalizable.rb
Convert your Localizable.strings (iOS) to strings.xml (Android)
#!/usr/bin/ruby
# based on https://github.com/tmurakam/cashflow/blob/0a01ac9e0350dfb04979986444244f8daf4cb5a8/android/convertStrings.rb
# support comments and Converter such as "%@", "%d", "%0.1f"...
# in your directory : ./main.rb Localizable.strings
file = File.open("strings.xml", "w");
file.puts "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
file.puts "<resources>"