Skip to content

Instantly share code, notes, and snippets.

View heinrichreimer's full-sized avatar

Jan Heinrich Reimer heinrichreimer

View GitHub Profile
function validate_url($url){
$result = preg_match("/^(https?:\/\/)([\da-z\.-]+)\.([a-z\.]{2,6})(\/([\da-z\.-]+))*\/?(([\w\.-]+)\.([\da-z]{2,6}))?((\#[\w\.-]+)|(\?([\da-z]+(=[\da-z]+)?)(&([\da-z]+(=[\da-z]+)?))*))?/i", $url);
return $result;
}
/*Usage*/
if(validate_url("http://heinrich-reimer.de")){
/*Do something*/
}
@heinrichreimer
heinrichreimer / hidden.css
Created September 24, 2013 14:06
Hide all elements with attribute "hidden"
[hidden]{
display:none;
}
@heinrichreimer
heinrichreimer / redirect.html
Last active March 30, 2017 02:00
Redirect to any other webpage. (JS required)
<script type="text/javascript">
<!--
window.location = "https://www.heinrichreimer.com/";
//–>
</script>