Skip to content

Instantly share code, notes, and snippets.

View Beanow's full-sized avatar

Robin van Boven Beanow

  • The Netherlands
  • 08:10 (UTC +02:00)
View GitHub Profile
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active April 22, 2024 19:02
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@kevincennis
kevincennis / getusermedia.js
Created July 19, 2013 23:17
getUserMedia
var ctx = new webkitAudioContext();
navigator.webkitGetUserMedia({audio: true}, success, err);
function success( stream ) {
var src = ctx.createMediaStreamSource(stream);
src.connect(ctx.destination);
}
function err( e ) {
@Avaq
Avaq / ClassLoader.php
Last active December 18, 2015 02:48
A FIG PSR-0 class loader heavily inspired on the official SplClassLoader. This version has a lot of improvements over the original. Be sure to star this gist if you liked it and leave your suggestions in the comment section beloowwwww!
<?php
/**
* Avaq's PSR-0 ClassLoader.
*
* @author Avaq <aldwin.vlasblom@gmail.com>
*
* A FIG PSR-0 class loader heavily inspired on
* [the official SplClassLoader](https://gist.github.com/jwage/221634) and originally
* developped for use in the [Forall framework](https://github.com/ForallFramework).