Skip to content

Instantly share code, notes, and snippets.

View taywils's full-sized avatar
🏠
Working from home

taywils

🏠
Working from home
View GitHub Profile
@taywils
taywils / AndroidPlacesTutorial_HttpTestActivity_Part_8.java
Created May 23, 2013 06:56
PlaceAdapter... adapters are such mindf#$%s
private class PlaceAdapter extends ArrayAdapter<Place> {
public Context context;
public int layoutResourceId;
public ArrayList<Place> places;
public PlaceAdapter(Context context, int layoutResourceId, ArrayList<Place> places) {
super(context, layoutResourceId, places);
this.layoutResourceId = layoutResourceId;
this.places = places;
}
private class MyLocationListener implements LocationListener {
@Override
public void onLocationChanged(Location location) {
latitude = String.valueOf(location.getLatitude());
longitude = String.valueOf(location.getLongitude());
}
@Override
public void onStatusChanged(String s, int i, Bundle bundle) {
public class MyRunnable implements Runnable {
public MyRunnable() {
}
public void run() {
myLocation.getLocation(getApplicationContext(), locationResult);
}
}
} // End of File
@taywils
taywils / AndroidPlacesTutorial_HttpTestActivity_Part_11.java
Created May 23, 2013 07:03
MyLocation class forked from stackoverflow user Fedor http://stackoverflow.com/users/95313/fedor I made a few modifications
package com.example;
import java.util.Timer;
import java.util.TimerTask;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
@taywils
taywils / AndroidPlacesTutorial_httptestrow.xml
Created May 23, 2013 07:07
httptestrow.xml, its what the Places adapter inflates
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@+id/htttptestrow_name"
android:textSize="16sp"
android:textStyle="bold"
android:layout_width="match_parent"
@taywils
taywils / AndroidPlacesTutorial_httptestlist.xml
Created May 23, 2013 07:09
The list view will contain the row view from the httptestrow.xml. Its kinda nice that they are separate and discrete as opposed to some giant mega-xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@+id/httptestlist_listview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
@taywils
taywils / AndroidPlacesTutorial_FULL_HttpTestActivity.java
Created June 1, 2013 04:18
The entire HttpTestActivity.java file minus my personal API key of course. Makes it easier for the reader in a hurry to just grab the code.
package com.example;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.app.ProgressDialog;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.AsyncTask;
import android.os.Bundle;
@taywils
taywils / AndroidPlacesTutorial_FULL_MyLocation.java
Created June 1, 2013 04:18
The entire MyLocation.java file.
package com.example;
import java.util.Timer;
import java.util.TimerTask;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
@taywils
taywils / gruntFileJsMinifyModule.js
Created June 11, 2013 01:19
A GruntFile.js for minifying CSS using Yahoo!'s yuicompressor and minifying JS using Google's Closure compiler. Note that the Javascript gets compiled to a single file while the minified css files remain separate.
module.exports = function(grunt) {
grunt.registerTask('compile-js', 'Runs GoogleClosure compiler on all javascript files', function() {
var exec = require('child_process').exec;
var done = grunt.task.current.async();
var compilationLevel = "--compilation_level SIMPLE_OPTIMIZATIONS ";
var cmd = "java -jar ./build/google-closure-compiler.jar " + compilationLevel;
var jsDir = "./javascript/";
var addJs = "--js " + jsDir;
var output = " --js_output_file ./build/deploy/javascript-compiled.js";
// Javascript files must be in the same order as loaded in the html file
@taywils
taywils / .vimrc
Last active May 21, 2024 04:56
My Mac OS X .vimrc for fresh installs
" Enable Pathogen
execute pathogen#infect()
" Enable Syntax
syntax on
" Enable Autowrite
set autowrite
" Indent based upon filetype when possible