Skip to content

Instantly share code, notes, and snippets.

View johnhiott's full-sized avatar

John Hiott johnhiott

  • York, SC
View GitHub Profile
package com.atsplod.tidely.ui.home
import android.Manifest.permission.ACCESS_FINE_LOCATION
import android.annotation.SuppressLint
import android.app.Activity
import android.util.Log
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.ExperimentalFoundationApi
String locationUri = String.format(Locale.getDefault(), "geo:%f,%f?q=%s", ll.latitude, ll.longitude,
(isSite) ? Utils.generateAddressForSite(site) : Utils.generateAddressForSiteContact(siteContact));
String locationUri = "";
if (isSite) {
locationUri = String.format(Locale.getDefault(), "geo:%f,%f?q=%s", ll.latitude, ll.longitude, Utils.generateAddressForSite(site));
}else {
locationUri = String.format(Locale.getDefault(), "geo:%f,%f?q=%s", ll.latitude, ll.longitude, Utils.generateAddressForSiteContact(siteContact));
}
//ONE FILE
class BaseClass {
int responseCode;
String reason;
//getters setters, what not
}
//TWO FILE
class TruckResponse extends BaseClass {
public class ChildClass {
private List<Callback> callbacks;
@UiHandler AcceptButton
void onClick(){
for (Callback callback : callbacks) {
callback.Accept()
}
}
<?php
try {
$db = new PDO("mysql:host=$C9_IP;dbname=$C9_DB", $C9_USER, $C9_PASS);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(Exception $ex) {
die($ex->getMessage());
}
@johnhiott
johnhiott / FitbitApi.java
Created March 30, 2014 14:19
Class to add Fitbit OAuth API to Scribe
public class FitbitApi extends DefaultApi10a {
public static final String BASE_URL = "http://api.fitbit.com/";
private static final String REQUEST_TOKEN_RESOURCE = "api.fitbit.com/oauth/request_token";
private static final String AUTHORIZE_URL = "https://api.fitbit.com/oauth/authorize?oauth_token=%s";
private static final String ACCESS_TOKEN_RESOURCE = "api.fitbit.com/oauth/access_token";
@Override
public String getAccessTokenEndpoint() {
return "https://" + ACCESS_TOKEN_RESOURCE;
}
@johnhiott
johnhiott / .htaccess
Created December 9, 2013 16:46
Angular HTML5 URL Rewriting
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.html#$1
@johnhiott
johnhiott / app.js
Created December 9, 2013 10:18
Enable AngularJS HTML5 Urls
var app = angular.module('johnhiott', []).
config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
//ADD THIS LINE
$locationProvider.html5Mode(true);
$routeProvider.
when('/home', {templateUrl: 'partials/home.html', controller: homeCtrl}).
when('/projects', {templateUrl: 'partials/projects.html', controller: projectsCtrl}).
when('/stats', {templateUrl: 'partials/stats.html', controller: statsCtrl}).