Skip to content

Instantly share code, notes, and snippets.

@ivanfgm
ivanfgm / routing.php
Last active November 22, 2016 18:37
Redirect to index in php built in server. taken from http://www.lornajane.net/posts/2012/php-5-4-built-in-webserver
<?php
if (file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI']))
return false;
include_once 'index.php';
@ivanfgm
ivanfgm / fast-scroll-detection.js
Last active September 25, 2018 22:27
Scroll detection using a request animation frame for smoothness, implementation for simple parallax.
// Returns the supported property name of a style property from an array of possible names, if non is supported, returns null
function supported_property_name(properties) {
for (var i = 0; i < properties.length; i++) {
if (typeof document.body.style[properties[i]] != "undefined") return properties[i];
}
return null;
}
var transforms = ["transform", "msTransform", "webkitTransform", "mozTransform", "oTransform"];
var transform = supported_property_name(transforms);
<script>function open_url (url) { window.open(url) } </script><div style="position:relative"><img src="/wp-content/uploads/2015/09/norma_final1.png" alt=""><svg style="position: absolute; top: 0; left: 0; width: 100%;" version="1.1" id="some" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1399.825 774.903" opacity="0"><circle style="cursor: pointer;" cx="286.293" cy="574.184" r="27.538" onclick="javascript:open_url('http://facebook.com/Sin-azúcar-por-favor-1430341217285874')"/><circle style="cursor: pointer;" cx="351.308" cy="574.184" r="27.538" onclick="javascript:open_url('http://twitter.com/SinAzucarPorFav')"/><circle style="cursor: pointer;" cx="416.57" cy="574.184" r="27.538" onclick="javascript:open_url('http://instagram.com/ferfam')"/></svg></div>