View Liberal Regex Pattern for Web URLs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View Liberal Regex Pattern for All URLs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The regex patterns in this gist are intended to match any URLs, | |
including "mailto:foo@example.com", "x-whatever://foo", etc. For a | |
pattern that attempts only to match web URLs (http, https), see: | |
https://gist.github.com/gruber/8891611 | |
# Single-line version of pattern: | |
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])) |
View iframe-reference.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
seamless="seamless" - Specifies that the <iframe> should look like it is a part of the containing document | |
allowTransparency="true" - old "seamless" alternative (is not a W3C spec/ option) | |
frameborder="0" - no border on old browsers (deprecated on HTML5) | |
scrolling="auto" - Specifies whether or not to display scrollbars in an <iframe> (deprecated on HTML5) | |
horizontalscrolling - force hide horizontal scrolling on (IE fix) | |
verticalscrolling - force hide vertical scrolling on (IE fix) | |
AUTO RESIZE IFRAME | |
https://github.com/davidjbradshaw/iframe-resizer |
View fullEncodeURI.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fullEncodeURI(str) { | |
if (str !== undefined && str !== null) { | |
str = '' + str; | |
var res = ''; | |
for(var i = 0, l = str.length; i < l ;) { | |
res += '%'; | |
res += str.charCodeAt(i++).toString('16'); | |
} | |
return res; | |
} |
View node-with-proxy-config.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set proxy=10.2.97.200:8080 | |
set loglevel=http | |
set domain=brq.com | |
:: Intro | |
echo Configuracao NODE JS & echo. | |
echo Entre com o login de rede. & echo. |
View load-template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
// <script type="text/x-html-template" data-src="url" async></script> | |
$("script[type='text/x-html-template']").each(function() { | |
var $el = $(this); | |
var src = $el.data('src'); | |
if (!src) return; | |
$.ajax({ | |
url: src, |
View decodeURIComponent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// about it: http://stackoverflow.com/a/12796866/1260526 | |
// Some Mozilla browsers do wrong conversion | |
decodeURIComponent(str.replace(/\+/gim,' ')); |
View test-title-attr-line-break.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>TEST - Line Break in title attribute</title> | |
<style> | |
.line-through { | |
text-decoration: line-through; | |
} |
View extends.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function EXTENDS(super_, extension) { | |
var obj = function() {}; | |
var proto = obj.prototype = new super_(); | |
proto.super = function() { | |
super_.apply(this, arguments); | |
}; | |
for (var prop in extension) { |
OlderNewer