Skip to content

Instantly share code, notes, and snippets.

Alex Ford chevtek

Block or report user

Report or block chevtek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View forEach.js
// Dummy array of strings.
var items = [
"One",
"Two",
"Three"
];
// Traditionally looping over the array requires:
// - Tracking the index yourself.
// - Comparing it to the length of the array yourself.
View font-bomb.js
javascript:(function () {var s = document.createElement('script');s.setAttribute('src', '//fontbomb.ilex.ca/js/main.js');document.body.appendChild(s);}());
@chevtek
chevtek / emailRegex.js
Created Oct 2, 2014
HTML 5 Email Validation Regular Expression
View emailRegex.js
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
View google-proxy.js
router.get('/google', function (req, res) {
var url = 'http://www.google.com';
request(url, function (err, response, body) {
res.send(body.replace(/(action|src|href)="((?!http)[^"]*)"/gi, function (match, g1, g2) {
return g1 + '="' + url + g2 + '"';
}));
});
});
You can’t perform that action at this time.