Skip to content

Instantly share code, notes, and snippets.

View hartzis's full-sized avatar

(Brian) Emil Hartz hartzis

View GitHub Profile
@hartzis
hartzis / jquery password validation
Created September 5, 2014 15:53
Beautiful password validation from stackexchange, 8 chars, 1 upper, 1 lower, 1 special
// Hold functions related to client side password validation
var password = function () {
var minPasswordLength = 8;
var _hasLowerCase = /[a-z]/;
var _hasUpperCase = /[A-Z]/;
var _hasDigit = /\d/;
var _hasNonWord = /(_|[^\w\d])/;
var password = [];
var parseTweet = function(tweetText) {
var reghash, reguri, regusername;
reguri = /(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/=]*))/g;
regusername = /([@]+([A-Za-z0-9-_]+))/g;
reghash = /[#]+([A-Za-z0-9-_]+)/g;
tweetText = tweetText.replace(reguri, "<a href='$1' target='_blank'>$1</a>");
tweetText = tweetText.replace(regusername, "<a href='http://twitter.com/$2' target='_blank'>$1</a>");
tweetText = tweetText.replace(reghash, "<a href='http://twitter.com/search?q=%23$1' target='_blank'>#$1</a>");
return tweetText;
};
@irrationalistic
irrationalistic / parseTweet.js
Created May 29, 2014 20:55
Parse Tweets - Simple
var parseTweet = function(tweetText) {
var reghash, reguri, regusername;
reguri = /(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/=]*))/g;
regusername = /([@]+([A-Za-z0-9-_]+))/g;
reghash = /[#]+([A-Za-z0-9-_]+)/g;
tweetText = tweetText.replace(reguri, "<a href='$1' target='_blank'>$1</a>");
tweetText = tweetText.replace(regusername, "<a href='http://twitter.com/$2' target='_blank'>$1</a>");
tweetText = tweetText.replace(reghash, "<a href='http://twitter.com/search?q=%23$1' target='_blank'>#$1</a>");
return tweetText;
};
@natelandau
natelandau / .bash_profile
Last active June 13, 2024 18:01
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@davidtheclark
davidtheclark / isElementInViewport.js
Created May 4, 2013 02:00
JavaScript: Is element in viewport?
/*
No jQuery necessary.
Thanks to Dan's StackOverflow answer for this:
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
*/
function isElementInViewport(el) {
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&