Skip to content

Instantly share code, notes, and snippets.

View stuporglue's full-sized avatar

Michael Moore stuporglue

  • Leverkusen, Germany
View GitHub Profile
@stuporglue
stuporglue / CSS_and_JavaScript_loading.php
Created September 15, 2017 13:00
Load required scripts and styles into a page if they're not already loaded.
<?php
/**
* We'll need access to these two objects.
*/
global $wp_scripts, $wp_styles;
/**
* Loop over all queued styles. If a style is still in the queue it hasn't been printed yet.
*
* Get its info so we can later check if it needs to be loaded.
@stuporglue
stuporglue / gist:c2db1157cdd1eb32efd73027c485e76a
Last active November 7, 2016 16:54
Using PHP and MySQL for Spatial Projects
GIS, or Geographic Information Science, is the study and use of data involving
locations. It's a broad field that includes spatial statistics, cartography,
routing, maps and much more.
PHP + MySQL is not a popular combination for GIS projects. However, given
how much of the internet the LAMP stack runs, it is inevitable
that we as PHP professionals will be asked to implement maps and other
spatial solutions in the software we develop.
What would you say if a client asked if PHP and MySQL are the right choices
-- PostGIS functions which will create an pollygon representing an ellipse using the "Pins and String" method
--
-- https://en.wikipedia.org/wiki/Ellipse#Pins-and-string_method
--
-- Usage: ST_Ellipse(LINESTRING, DISTANCE, NUMBER OF NODES);
-- Usage: ST_Ellipse(LINESTRING, DISTANCE); -- defaults to 8 nodes
--
-- Args:
-- LINESTRING -- A two point linestring. Use ST_MakeLine(p1,p2) if you have two points