Skip to content

Instantly share code, notes, and snippets.

View javawolfpack's full-sized avatar

Bryan Dixon PhD javawolfpack

View GitHub Profile
@javawolfpack
javawolfpack / test.html
Created August 8, 2015 18:04
Gist of AJAX test code
<script>
new Ajax.Request('/test2', {
method:'get',
onSuccess: function(transport) {
var response = transport.responseText || "no response text";
//alert("Success! \n\n" + response);
$('content').replace(response)
new Ajax.Request('/test3', {
method:'get',
onSuccess: function(transport) {
@javawolfpack
javawolfpack / gist:29dd151c5fbfdbf28ba3
Created June 29, 2015 20:17
Android Keystore SHA1 command, run from directory of keystore
keytool -list -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android
@javawolfpack
javawolfpack / lock.java
Created June 22, 2015 20:57
WiFi Lock Example from lecture on different version
WifiLock lk;
final int sdkVersion = Integer.parseInt(Build.VERSION.SDK);
if (sdkVersion >= Build.VERSION_CODES.HONEYCOMB_MR1) {
Log.d(TAG, "hi-perf wifi lock");
lk = wfManager.createWifiLock(3, "LockTag");
}
else{
lk = wfManager.createWifiLock(WifiManager.WIFI_MODE_FULL, "LockTag");
}
@javawolfpack
javawolfpack / intentgist
Created June 10, 2015 18:21
Intent Reciever
//DataReceiver is my Broadcast Reciever Class
intentReceiver = new DataReceiver();
filter = new IntentFilter();
//Add intents to recieve
filter.addAction(Intent.ACTION_CAMERA_BUTTON);
registerReceiver(intentReceiver, filter);
@javawolfpack
javawolfpack / post.java
Created April 10, 2015 02:05
HTTP Post Example
HttpPost httpost = new HttpPost("<Server address here>");
StringEntity se = new StringEntity(JSONObject.toString());
httpost.setEntity(se);
httpost.setHeader("Accept", "application/json");
httpost.setHeader("Content-type", "application/json");
ResponseHandler responseHandler = new BasicResponseHandler();
String responseBody = httpclient.execute(httpost, responseHandler);
@javawolfpack
javawolfpack / ActivityDetectionIntentService.java
Last active August 29, 2015 14:18
Code from lecture 4/7/15
import android.app.IntentService;
import android.content.Intent;
import android.util.Log;
import com.google.android.gms.location.ActivityRecognitionResult;
import com.google.android.gms.location.DetectedActivity;
/**
* Created by bryandixon on 4/6/15.
*/
#include <stdio.h>
#include <unistd.h>
int main()
{
/* fork a child process */
fork();
/* fork another child process */
fork();
/* and fork another */