Skip to content

Instantly share code, notes, and snippets.

View justintoth's full-sized avatar

Justin Toth justintoth

View GitHub Profile
@justintoth
justintoth / gist:2251294
Created March 30, 2012 12:47
Send_ICD15_Garmin_Job_To_Offline_Vehicle
> Description: Send an icd 15 garmin job to offline vehicle then sign on and validate that job gets sent
> Sending sign off to vehicle server from vehicle 255.255.202.020
Received message: Peripheral Type: Garmin<br/>Message Type: Garmin Text Message<br/>Origination Time: 2/1/2012 4:52 PM<br/>Text Message: Test Driver: Hello World 2/1/2012 11:53:02 AM<br/>
Received message: Peripheral Type: Garmin<br/>Message Type: Garmin Text Message<br/>Origination Time: 2/1/2012 8:45 PM<br/>Text Message: Test Driver: Hello World 2/1/2012 3:45:51 PM<br/>
Received message: Peripheral Type: Garmin<br/>Message Type: Garmin Text Message<br/>Origination Time: 2/1/2012 8:47 PM<br/>Text Message: Test Driver: Hello World 2/1/2012 3:47:31 PM<br/>
Received message: Peripheral Type: Garmin<br/>Message Type: Garmin Text Message<br/>Origination Time: 2/1/2012 8:48 PM<br/>Text Message: Test Driver: Hello World 2/1/2012 3:48:41 PM<br/>
Received message: Peripheral Type: Garmin<br/>Message Type: Garmin Text Message<br/>Origination Time: 2/
------ Test started: Assembly: SystemTest.dll ------
> Description: Send an icd 15 garmin job to offline vehicle then sign on and validate that job gets sent
> Sending sign off to vehicle server from vehicle 255.255.202.020
> Sending job to leapfrog services (mimicking MyNavtrak)
> Job was sent successfully to leapfrog services
> Job with id 20432 was saved to jobs table
> Validated that vehicle 255.255.202.020 has correct driver testdriver@navtrak.net with user id 52510 assigned to it
> Validated that peripheral with id 29 has correct driver testdriver@navtrak.net with user id 52510 assigned to it
> Offline job was not received yet
@justintoth
justintoth / HttpStatusCode.cs
Created April 3, 2012 13:19
HttpStatusCode
#region Assembly System.dll, v4.0.0.0
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll
#endregion
using System;
namespace System.Net
{
// Summary:
// Contains the values of status codes defined for HTTP.
@justintoth
justintoth / Map.js
Created April 11, 2012 00:02
Map.js
function Map() {
var self = this;
this.top = 0;
this.bottom = 0;
this.latitude = 0;
this.longitude = 0;
this.delta = 0.1;
this.display = "map";
@justintoth
justintoth / ListingMapView.js
Created April 11, 2012 00:02
ListingMapView.js
function createListingMapView(latitude, longitude) {
return tt.ui.createWindow("Listing Map", function () { listingsmap.init(latitude, longitude); });
}
var listingsmap = {
init: function (latitude, longitude) {
listingsmap.coordinates = { Latitude: latitude, Longitude: longitude };
listingsmap.display();
@justintoth
justintoth / NavigationActivity.java
Created April 19, 2012 19:41
NavigationActivity Exit
final ApplicationHandler msgHandler = new ApplicationHandler() {
@Override
public void onApplicationEvent(int nEvent, String strData) {
Log("Event No. " + Integer.toString(nEvent) + " detected."); // event handling
switch (nEvent) {
case ApplicationEvents.EVENT_APP_EXIT:
Log("In EVENT_APP_EXIT event");
Finish(SygicModule.EXIT_NORMAL, true);
break;
}
@justintoth
justintoth / SygicDriveActivity.java
Created April 25, 2012 13:54
Sygic Navigate To
private void navigateTo(Float latitude, Float longitude, int numTries) {
try
{
Log("Navigating to: " + latitude + " / " + longitude + " for try #" + numTries);
Integer lat = (int)(latitude * 100000);
Integer lon = (int)(longitude * 100000);
//get lat/long of address.
SWayPoint wayPoint = new SWayPoint();
wayPoint.Location = new LONGPOSITION(lon, lat);
@justintoth
justintoth / TibarModule.m
Created November 28, 2012 19:59
TibarModule.m
/**
* Your Copyright Here
*
* Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc.
* and licensed under the Apache Public License (version 2)
*/
#import "TibarModule.h"
#import "TiBase.h"
#import "TiHost.h"
#import "TiUtils.h"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Configuration;
using Newtonsoft.Json;
using Housters.Schemas.Models.Account;
using Housters.Business.Utility.Helpers;
namespace Housters.Business.Services.Account.Billing {
public static class BalancedService {
public static string PostWithAuth(string url, string requestBody = null, string method = "POST") {
using (WebClient client = new WebClient()) {
var credentials = Convert.ToBase64String(Encoding.Default.GetBytes(APIKey));
client.Headers.Add(HttpRequestHeader.Authorization, credentials);
client.Headers.Add(HttpRequestHeader.ContentType, "application/json");//x-www-form-urlencoded
if (!String.IsNullOrEmpty(requestBody))
return client.UploadString(url, method, requestBody);
else
return client.UploadString(url, method);
}