Skip to content

Instantly share code, notes, and snippets.

View displaynone's full-sized avatar

Luis Sacristán displaynone

View GitHub Profile
@displaynone
displaynone / wordpress_geo_searchs.sql
Created February 15, 2017 18:49
Geolocalization for WordPress queries
CREATE PROCEDURE geodist (IN mylat decimal(18,12), IN mylon decimal(18,12), IN dist float)
BEGIN
declare lon1 float;
declare lon2 float;
declare lat1 float;
declare lat2 float;
set lon1 = mylon-dist/abs(cos(radians(mylat))*69);
set lon2 = mylon+dist/abs(cos(radians(mylat))*69);
set lat1 = mylat-(dist/69);
set lat2 = mylat+(dist/69);
@displaynone
displaynone / change_content_svg.js
Last active February 11, 2017 22:39
Modify SVG into CSS content for inline CSS
// Suppose we have a CSS element with a SVG into the content property
// .class:before {
// content: url('imagen.svg');
// }
//
// This script replaces the SVG in the CSS for the inline CSS so you can access via JS or CSS later
jQuery(document).ready(function() {
var replaceWithSVG = function(selector, url) {
jQuery('').appendTo('head');
// Gets the SVG file