Skip to content

Instantly share code, notes, and snippets.

drewlarsen

Block or report user

Report or block drewlarsen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@drewlarsen
drewlarsen / sugarwod.java
Last active Apr 26, 2019
How to Open SugarWOD from another Android App
View sugarwod.java
// Adapted from:
// https://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent/7596063#7596063
/** Open SugarWOD.
* @param context current Context, like Activity, App, or Service
* @return true if likely successful, false if unsuccessful
*/
public static boolean openSugarWOD(Context context) {
String packageName = "com.flatironssoftware.sugarwod";
PackageManager manager = context.getPackageManager();
@drewlarsen
drewlarsen / sugarwod.m
Created Feb 1, 2018
How to Open SugarWOD from another iOS App
View sugarwod.m
// Sample code to open the SugarWOD iOS app from another app
// will attempt to open the app,
// if app is not installed,
// will re-direct to the SugarWOD page in the app store or in Safari
// SugarWOD URL Scheme
NSURL *url = [NSURL URLWithString:@"sugarwod://"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
// open sugarwod app
@drewlarsen
drewlarsen / gist:2fbf0c93e990dbe8848e028b861fac2d
Created Nov 10, 2016
Sample code to open the SugarWOD iOS app with the URL Link Scheme
View gist:2fbf0c93e990dbe8848e028b861fac2d
#pragma mark URL SCHEME TESTING
- (IBAction)launchButtonTouchUpInside:(UIButton *)sender {
// Sample code to open the SugarWOD iOS app from another app
// will attempt to open the app,
// if app is not installed,
// will re-direct to the SugarWOD page in the app store or in Safari
// SugarWOD URL Scheme
NSURL *url = [NSURL URLWithString:@"sugarwod://"];
@drewlarsen
drewlarsen / promises-with-validations.js
Last active Jul 23, 2017
A pattern for a Parse.com Cloud Code function using Promises, including validations, fetches, saves.
View promises-with-validations.js
// A cloud Code function that is called from iOS, Android and web
// each time an athlete logs into the app
// Updates the athlete and creates an entry in the "TB_Login" class
// NOTE: isDefined is a utility function defined elsewhere
Parse.Cloud.define("athleteDidLogin", function(request, response) {
// req'd params
var athId = request.params.athId;
You can’t perform that action at this time.