Skip to content

Instantly share code, notes, and snippets.

View Gowiem's full-sized avatar
🌤️
Stoked on Terraforming

Matt Gowie Gowiem

🌤️
Stoked on Terraforming
View GitHub Profile
class ContextSpecificObjectArray < Array
def initialize(objects)
super
end
def test
raise self.to_yaml
end
@Gowiem
Gowiem / My .emacs
Created May 28, 2012 04:16
Critique my .emacs, Thanks!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Gowie's .emacs file ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Directory for my installed packages
(add-to-list 'load-path "~/.emacs.d/")
;; Not sure why I have to add these to the path?
(add-to-list 'load-path "~/.emacs.d/scala")
(add-to-list 'load-path "~/.emacs.d/coffee-mode")
;; (add-to-list 'load-path "~/.emacs.d/ensime/elisp/")
@Gowiem
Gowiem / gist:2917996
Created June 12, 2012 14:52
Send data in bundle
Intent mPoiDetailIntent = new Intent(PoiListActivity.this, PoiDetailActivity.class);
mPoiDetailIntent.putExtra("POINT_OF_INTEREST", poiClicked);
startActivity(mPoiDetailIntent);
// Then in the activtity that is recieving, so the PoiDetailActivity.class:
Bundle b = getIntent().getExtras();
if(b != null){ // Activity started from PoiListActivity
mPointOfInterest = (PointOfInterest) b.getSerializable("POINT_OF_INTEREST");
@Gowiem
Gowiem / InstallationListActivity.java
Created June 13, 2012 19:12
Adding Header to List Code
setContentView(R.layout.list);
final ListView installationListView = getListView();
LayoutInflater inflater = getLayoutInflater();
ViewGroup header = (ViewGroup) inflater.inflate(R.layout.header, installationListView, false);
TextView headerText = (TextView) header.findViewById(R.id.header_text);
headerText.setText("Installations On Live"); // TODO: This should not be hardcoded
installationListView.addHeaderView(header, null, false);
setListAdapter(new ArrayAdapter<Installation>(InstallationListActivity.this, android.R.layout.simple_list_item_1, installations));
@Gowiem
Gowiem / app.coffee
Created June 17, 2012 21:06
Why is this event getting fired??
init = ->
console.log "onload called!"
document.addEventListener("devicereadyisstupid", onDeviceReady(), false)
onDeviceReady = () ->
isPhoneGapReady = true
console.log("DEVICEREADY!")
window.onload = init()
@Gowiem
Gowiem / ReadData.java
Created June 18, 2012 14:19
Reading byte data from a url.
HttpClient client = new DefaultHttpClient();
HttpURLConnection.setFollowRedirects(false);
HttpURLConnection connection = (HttpURLConnection) new URL(serverDirectoryUrl).openConnection();
connection.setIfModifiedSince(ifModifiedBeforeDate.getTime());
int byteArraySize = connection.getContentLength();
Log.d(TAG, "Byte Array Size: " + byteArraySize);
byte[] response = new byte[byteArraySize];
InputStream connectionInputStream = connection.getInputStream();
int bytesRead = connectionInputStream.read(response);
@Gowiem
Gowiem / FileManager.java
Created June 20, 2012 19:27
FileManager class, which uses HashMaps as a Cache for [AutoUpdating]PreloadedFiles
package com.tapwalk.android.DataManagement;
import java.util.HashMap;
import java.util.Map;
/**
* Created with IntelliJ IDEA.
* User: Matt Gowie
* Date: 6/20/12
* Time: 3:08 PM
@Gowiem
Gowiem / map-and-markers.js
Created August 30, 2012 20:20
Map marker placement code. Also handles orientation change.
// map-and-markers.js
// By: Matt Gowie
// If you're checking this out and you have any comments or suggestions on how
// this code could be improved, send me over an email at gowie.matt@gmail.com
// Thanks!
///////////////////////////////////////////////////////////////////////////////
$(function() {
$('img.marker').hide(); // hide these till ready
var $map = $('#map');
@Gowiem
Gowiem / venues_controller.rb
Created September 10, 2012 19:48
'dump' hash into methods problem
def show
if @app_navigation == "TabBar"
first_screen = TapwalkLink.new(@app_config.menu_items[0])
redirect_to url_for(:controller => first_screen.controller, first_screen.link_params)
end
end
@Gowiem
Gowiem / flw.sh
Created October 2, 2012 19:06
Follow Script
# This is in my .bash_aliases:
alias flw="source ~/Programs/flw.sh"
# ~/Programs/flw.sh
#!/bin/bash
# Follow Script written by Matt Gowie
if [[ $2 && ${2-x} && $3 && ${3-x} ]]; then