Skip to content

Instantly share code, notes, and snippets.

View rgwozdz's full-sized avatar

Rich Gwozdz rgwozdz

  • Esri
  • Bellingham, WA
View GitHub Profile
@rgwozdz
rgwozdz / green-square.svg
Created February 16, 2024 22:49
green-square
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rgwozdz
rgwozdz / refactor-this.js
Created October 20, 2021 14:10
Refactoring challenge
function getErrorMessage(code) {
if (
code === 702 ||
code === 1082 ||
code === 1083 ||
code === 1114 ||
code === 1184 ||
code === 1266 ||
code === 12403
) {
Model.prototype.createKey = function (req) {
let key = req.url.split('/')[1]
if (req.params.host) key = `${key}::${req.params.host}`
if (req.params.id) key = `${key}::${req.params.id}`
key = (req.query.startdate && req.query.enddate) ? `${key}::${req.params.startdate}::${req.params.enddate}` : ''
return key
}
@rgwozdz
rgwozdz / greenland.geojson
Created June 4, 2018 20:56 — forked from pnavarrc/greenland.geojson
Greenland Scaled
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rgwozdz
rgwozdz / mixed.geojson
Created May 31, 2018 13:54
GeoJSON with mixed geometry Feature Collection
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rgwozdz
rgwozdz / koop-auth-authenticate.js
Created May 30, 2018 21:10
Koop-docs: authenticate-example
/**
* Authenticate a user's submitted credentials
* @param {string} username requester's username
* @param {strting} password requester's password
* @returns {Promise}
*/
function authenticate (username, password) {
return new Promise((resolve, reject) => {
// Validate user's credentials
validateCredentials(username, password, _userStoreFilePath)
@rgwozdz
rgwozdz / koop-ouput-services-authorize.js
Created May 30, 2018 20:19
Koop-docs: output-services usage of authorize
/**
* Handler for service, layer, and query routes
* @param {object} req request object
* @param {object} res response object
*/
Geoservices.prototype.featureServer = function (req, res) {
// Is model configured for token-authorization?
if (typeof this.model.authorize === 'function') {
this.model.authorize(req.query.token)
.then(valid => {
@rgwozdz
rgwozdz / koop-auth-authentication-response.js
Created May 30, 2018 17:52
Koop-docs: authentication-response
{
token: String, // token that can be added to resource requests, and decoded and verified by the "authorization" function
expires: Number, // number seconds until token expires
}
@rgwozdz
rgwozdz / koop-auth-module-authentication-specification.js
Last active June 8, 2018 16:04
Koop-docs: authentication-specification
{
useHttp: Boolean // boolean flag indicating if HTTP (rather than HTTPS) should be used for the authentication endpoint
}
@rgwozdz
rgwozdz / koop-auth-module-index-export.js
Last active May 30, 2018 17:47
Koop-Docs: auth-module registration object
{
type: 'auth',
getAuthenticationSpecification: Function,
authenticate: Function,
authorize: Function
}