Skip to content

Instantly share code, notes, and snippets.

View astjohn's full-sized avatar

Adam St. John astjohn

View GitHub Profile
@astjohn
astjohn / entryRequirement.js
Created June 7, 2021 12:28
Travel Restriction and Entry Requirement utility functions. Used with the Sitata API for country and state-level entry requirement and travel restriction information. https://postman.sitata.com
/**
* Utility functions for Entry Requirement
*/
class EntryRequirement {
static types () {
return {
entryResident: 0,
entryForeigner: 1,
transitAllowed: 2,
testOnArrival: 3,
@astjohn
astjohn / appDelegate.cs
Created October 4, 2017 15:09
xamarin setup with push notifications
using Foundation;
using SitataCore;
using UIKit;
using UserNotifications;
namespace SitataQs
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
@astjohn
astjohn / stuff.cs
Created October 4, 2017 13:47
xamarin setup for sitata gui
// application class
namespace YOUR_NAMESPACE {
[Application]
class YourApp : Application {
private static SitataGui MySitataGui { get; set; }
public YourApp( IntPtr handle, JniHandleOwnership transfer ) : base( handle, transfer ) { }
// Service class to obtain push notification token
//
//
import com.sitata.sdk.controller.SitataController;
public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {
private static final String TAG = "MyFirebaseIIDService";
@Override
@astjohn
astjohn / app delegate
Created October 3, 2017 19:43
push notification xamarin
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// do some stuff
// check if launched by push tap
if (launchOptions != null && launchOptions[UIApplication.LaunchOptionsRemoteNotificationKey] != null)
{
// re-using remote notification logic here for when app loads after user
// has interacted with remote notification from tray
this.DidReceiveRemoteNotification(application, launchOptions, (UIBackgroundFetchResult result) =>
unzip -vl /Users/astjohn/Development/sitata/mobile/sdk/sdk-xamarin-bindings-ios/SitataCore.iOS/obj/Debug/SitataCore.framework
Archive: /Users/astjohn/Development/sitata/mobile/sdk/sdk-xamarin-bindings-ios/SitataCore.iOS/obj/Debug/SitataCore.framework
Length Method Size Cmpr Date Time CRC-32 Name
-------- ------ ------- ---- ---------- ----- -------- ----
6148 Defl:N 285 95% 09-28-2017 15:33 f085dfa0 .DS_Store
0 Stored 0 0% 09-28-2017 15:33 00000000 GooglePlaces.bundle/
0 Stored 0 0% 09-28-2017 15:32 00000000 GooglePlaces.bundle/ar.lproj/
703 Defl:N 457 35% 09-28-2017 15:32 99f2f526 GooglePlaces.bundle/ar.lproj/GooglePlaces.strings
0 Stored 0 0% 09-28-2017 15:32 00000000 GooglePlaces.bundle/ca.lproj/
698 Defl:N 466 33% 09-28-2017 15:32 d3252a6c GooglePlaces.bundle/ca.lproj/GooglePlaces.strings
Microsoft (R) Build Engine version 15.3.0.0 (d15.3/17f02c2 Thu Jul 20 17:17:06 EDT 2017) for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/MSBuild.dll /verbosity:diag SitataCore.iOS.csproj
Build started 2017-09-29 2:13:48 PM.
Environment at start of build:
COLORTERM = truecolor
rvm_bin_path = /Users/astjohn/.rvm/bin
LOGNAME = astjohn
CLICOLOR = 1
$ unzip -vl /Users/astjohn/Development/sitata/mobile/sdk/sdk-xamarin-bindings-ios/demo/SitataQs/obj/iPhoneSimulator/Release/mtouch-cache/SitataCore.framework.zip
Archive: /Users/astjohn/Development/sitata/mobile/sdk/sdk-xamarin-bindings-ios/demo/SitataQs/obj/iPhoneSimulator/Release/mtouch-cache/SitataCore.framework.zip
Length Method Size Cmpr Date Time CRC-32 Name
-------- ------ ------- ---- ---------- ----- -------- ----
0 Stored 0 0% 09-28-2017 15:33 00000000 Headers/
1178 Defl:N 366 69% 09-28-2017 15:33 87ea032d Headers/SitataCore-umbrella.h
960 Defl:N 413 57% 09-28-2017 15:17 bed6fc41 Headers/STASDKApiAlert.h
546 Defl:N 301 45% 09-28-2017 15:17 4f396f19 Headers/STASDKApiCountry.h
1307 Defl:N 369 72% 09-28-2017 15:17 389dfb71 Headers/STASDKApiHealth.h
459 Defl:N 274 40% 09-28-2017 15:32 f51eec09 Headers/STASDKApiMisc.h
@astjohn
astjohn / example.js.coffee
Last active December 16, 2015 18:29
Attempting to get torquebox stomplets working. Using torquebox 2.3.0. Cookie based session storage, though torquebox_store produces same result.
# Example coffeescript
_initialize_stomp: ->
@stomp_client.connect(null, null, (response) =>
console.log "STOMP CONNECT", response
@stomp_client.subscribe("/trips/#{@trip_id}/travel_package", (message) ->
console.log "SUBSCRIBED", message
)
)
@astjohn
astjohn / authentication.rb
Created November 1, 2012 18:59
Rspec Setup for Controller Testing With Devise
# /spec/support/authentication.rb
# sign in methods to use in a before block
# you will then have access to the corresponding account variable such as '@user'
# or '@admin' throughout your test suite
# sign in a user
def sign_in_user(user=nil)
sign_out_all
@user = user || FactoryGirl.create(:user_w_trip)