Skip to content

Instantly share code, notes, and snippets.

View phil-brown's full-sized avatar

Phil Brown phil-brown

  • Boston, MA
View GitHub Profile
@phil-brown
phil-brown / droidQuery-rss
Created August 7, 2013 20:22
An example of how one can use android-rss (https://github.com/ahorn/android-rss) with droidQuery (http://bit.ly/droidquery).
final RSSHandler handler = new RSSHandler(new RSSConfig());
$.ajax(new AjaxOptions().url(options.url())
.type("GET")
.dataType("XML")
.context(this)
.SAXContentHandler(handler)
.success(new Function() {
@Override
public void invoke($ droidQuery, Object... params) {
RSSFeed feed = handler.feed();
@daniellevass
daniellevass / starting_library_project_AS.md
Last active August 30, 2020 00:48
Getting Started with a library project in Android Studio

Getting Started with a library project in Android Studio

So we're working on creating Android Material Awesome, a library which will hopefully incorperate the benefits of Material Design, Twitter's Bootstrap, and FontAwesome. What we really wanted is a project other people can easily include into their projects using gradle dependencies. To do this we needed to create a standalone library project so we could make it as lightweight as possible for including as a dependency, and a sample app that would use it for testing. These are the steps we took to get started in Android Studio (version 1.1).

Create Projects

The first thing we needed to do was to create two new projects, with all the default settings (Blank Activity etc). One for our sample app, and one for our library. We added both of ours into the same GitHub repo, however you can save them wherever you like.

Fix Up Library Project

@fabiankessler
fabiankessler / LocaleUtility.java
Last active January 3, 2017 07:54 — forked from phil-brown/LocaleUtility.java
Utility for getting the Script String using a Locale. This is useful, for example, in Android, where this is not part of the Locale Object. To use this, simply call `LocaleUtility.getScript(Locale.getDefault());` to get the script for the current users' Locale.
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/*
* Source https://gist.github.com/phil-brown/8056700
@vananth22
vananth22 / HaversineDistance.java
Created July 28, 2016 04:46
Java Implementation of Haversine Formula for distance calculation between two points
/**
* This is the implementation Haversine Distance Algorithm between two places
* @author ananth
* R = earth’s radius (mean radius = 6,371km)
Δlat = lat2− lat1
Δlong = long2− long1
a = sin²(Δlat/2) + cos(lat1).cos(lat2).sin²(Δlong/2)
c = 2.atan2(√a, √(1−a))
d = R.c
*