Skip to content

Instantly share code, notes, and snippets.

Avatar

Jorge E. Hernández lalongooo

View GitHub Profile
@lalongooo
lalongooo / gist:95fbda3ebeaeff865438
Created May 28, 2015
Add new items to top of an android ListView
View gist:95fbda3ebeaeff865438
//Method onRefresh() from SwipeRefreshLayout.OnRefreshListener
@Override
public void onRefresh() {
// I'm using Retrofit, so this is the way I get new data from the server
new RestAdapter().get().getItems(new Callback<List<Foo>>() {
@Override
public void success(List<Foo> foos, Response response) {
// IMPORTANT: This is important to add new items at the top of the listview
View gist:370115afbfec625db967
private LatLng getLatLng(String lat, String lng){
LatLng ll = null;
if(lat.length() == 6 && lng.length() == 7){
double hoursLat = Double.valueOf(lat.substring(0,2));
double minLat = Double.valueOf(lat.substring(2,4));
double secLat = Double.valueOf(lat.substring(4,6));
double hoursLng = Double.valueOf(lng.substring(0,3));
double minLng = Double.valueOf(lng.substring(3,5));
@lalongooo
lalongooo / edges.java
Created Jul 10, 2016
Johnson's algorithm
View edges.java
graph.addEdge(2889, 2781);
graph.addEdge(2889, 156);
graph.addEdge(2881, 2886);
graph.addEdge(2881, 2590);
graph.addEdge(2881, 2112);
graph.addEdge(2881, 1978);
graph.addEdge(2881, 1938);
graph.addEdge(2881, 482);
graph.addEdge(2881, 389);
graph.addEdge(2875, 2886);
View vector-drawable-1.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="12dp"
android:viewportWidth="12"
android:viewportHeight="12">
<path
android:name="my_path"
android:pathData="M 6 3 L 6 9"
android:strokeColor="#a4c639"
You can’t perform that action at this time.