Skip to content

Instantly share code, notes, and snippets.

View vicchi's full-sized avatar

Gary Gale vicchi

View GitHub Profile
@vicchi
vicchi / main.py
Last active September 5, 2023 09:59
Versioned documentation in FastAPI, based on https://gist.github.com/Kludex/1c515aa38d22ec28d514da6b6f36da9f
# uvicorn main:app --host $(hostname) --port 8080 --log-level debug --reload
from fastapi import APIRouter, FastAPI
from utils import create_versioned_docs
VERSION = '2.0.0'
TITLE = 'Sample Versioned API'
DESCRIPTION = 'Sample versioned API blurb'
app = FastAPI(docs_url=None, redoc_url=None, title=TITLE, version=VERSION, description=DESCRIPTION)
@vicchi
vicchi / # osgeo-qgis - 2019-05-21_12-51-31.txt
Created May 21, 2019 14:33
osgeo-qgis (osgeo/osgeo4mac/osgeo-qgis) on macOS 10.14.5 - Homebrew build logs
Homebrew build logs for osgeo/osgeo4mac/osgeo-qgis on macOS 10.14.5
Build date: 2019-05-21 12:51:31
@vicchi
vicchi / what3words-xmlhttprequest.js
Created February 22, 2016 08:53
what3words API authentication with XMLHttpRequest
function loadConfig(callback) {
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open('GET', './config.json', true);
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
// Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode
callback(xobj.responseText);
}
};
@vicchi
vicchi / what3words-jquery.js
Created February 22, 2016 08:48
what3words API authentication with jQuery
var json = (function() {
var json = null;
$.ajax({
'async': true,
'global': false,
'url': "./config.json",
'dataType': "json",
'success': function (data) {
json = data;
}
@vicchi
vicchi / what3words-node.js
Created February 22, 2016 08:45
what3words API authentication with Node.js
var json = require('./config.json');
var key = json.what3words.key;
var options = {
key: key
lang: 'en'
};
var w3w = new What3words(options);
@vicchi
vicchi / config.json
Created February 22, 2016 08:39
General JSON configuration file for the what3words Javascript wrapper
{
"what3words": {
"key": "your-api-key-here"
}
}
2015-05-09 12:18:27 +0100
./configure
--enable-layout=Homebrew
--enable-mods-shared=all
--enable-unique-id
--enable-ssl
--enable-dav
--enable-cache
--enable-proxy
@vicchi
vicchi / 04.python
Created March 12, 2014 10:09
Homebrew libxml2 Build Failure
$ cat ~/Library/Logs/Homebrew/libxml2/04.python
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:251: UserWarning: 'licence' distribution option is deprecated; use 'license'
warnings.warn(msg)
libxslt stub generator not found, libxslt not built
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-intel-2.7
copying libxml2.py -> build/lib.macosx-10.9-intel-2.7
@vicchi
vicchi / custom-loop.php
Created May 10, 2013 13:51
Using WP Biographia template tags within a custom Loop
<?php
/*
Template Name Posts: Desktops
*/
get_header();
?>
<!--sub head container-->
@vicchi
vicchi / page-biographies.php
Created May 10, 2013 08:26
Custom page template, based on the stock Twenty Ten theme, to produce a list of each user's WP Biographia Biography Box followed by that user's latest post. Assumes PHP 5.0 and higher.
<?php
/**
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
* Template Name: Biographies
*/
$fields = array(0 => 'ID', 1 => 'user_login');
$args = array('orderby' => 'nicename', 'fields' => $fields);