Skip to content

Instantly share code, notes, and snippets.

@rowej83
rowej83 / gist:9203246
Last active August 29, 2015 13:56
c# - returns true boolean if valid email address, not case sensitive
public bool checkIfEmail(string checkString){
string regex=@"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" +
@"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,24}))$";
return Regex.IsMatch(checkString,regex,RegexOptions.IgnoreCase);
}
@rowej83
rowej83 / lighter-color-variation.less
Last active August 29, 2015 14:02
Input: 4 color values (i.e. Hex)Output: 4 lighter variations of each of the input color values
/*
Enter up to 4 colors to create lighter versions
Replace the #fffff values.
*/
@primary-color:#fffff;
@primary-color-75:lighten(@primary-color,%25);
@primary-color-50:lighten(@primary-color,%50);
@primary-color-25:lighten(@primary-color,%75);
@secondary-color:#ffff;
@rowej83
rowej83 / isValidEmailAddress.js
Created June 4, 2014 23:42
Checks if input is a valid email address.
function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^(("[\w-+\s]+")|([\w-+]+(?:\.[\w-+]+)*)|("[\w-+\s]+")([\w-+]+(?:\.[\w-+]+)*))(@((?:[\w-+]+\.)*\w[\w-+]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][\d]\.|1[\d]{2}\.|[\d]{1,2}\.))((25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\.){2}(25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\]?$)/i);
return pattern.test(emailAddress);
};
@rowej83
rowej83 / scroll_to_top.js
Last active August 29, 2015 14:02
Used to create a short cut to the top of the page if the user scrolls down
/*
Used to create a short cut to the top of the page if the user scrolls down. jQuery is needed.
Required:
Create a div with id="go-to-top" with a nested anchor link.
Place scroll_to_top function inside doc ready().
Place a css condition tag for lte IE9 to set #go-to-top to display:none;
*/
function scroll_to_top() {
@rowej83
rowej83 / line-behind-header.html
Last active March 13, 2019 16:48
Create a header with a line running behind it. Includes html and css required
<!--
ADD CSS TO STYLE SHEETS TO USE
.line-container {
position: relative;
text-align: center;
z-index:10;
}
.line-container:before {
content: "";
@rowej83
rowej83 / example.html
Created June 27, 2014 12:22 — forked from JeffreyWay/example.html
array_chunk() usage
@foreach(array_chunk($posts, 3) as $postSet)
<div class="row"> <!-- this div will surround every three posts -->
@foreach($postSet as $post)
<h3>{{ $post['title'] }}</h3>
@endforeach
</div>
@endforeach
@rowej83
rowej83 / responsive-helpers
Created July 23, 2014 13:01
Hidden/Visible responsive helper classes for PureCSS Framework - using pixels or EMs
/* pure-hidden-xs */
@media screen and (max-width:567px) {
.pure-visible-sm{display:none}
.pure-visible-md{display:none}
.pure-visible-lg{display:none}
.pure-visible-xl{display:none}
.pure-hidden-xs{display:none}
}
/* pure-hidden-sm */
@media screen and (min-width:568px) and (max-width:767px) {
@rowej83
rowej83 / helperPureCSS
Created July 23, 2014 13:33
PureCSS helper file for responsive and text align utilities
/*
Credit belongs to : https://github.com/phoenixh/pure/blob/ba9a809c633e987a72b39e001c82bc5d102c0f11/src/helper/css/helper.css
*/
/* Display or Hide Pure-U Blocks*/
.display-sm,
.display-md,
.display-lg,
.display-xl {
function addEvent( obj, type, fn ) {
if ( obj.attachEvent ) {
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
obj.attachEvent( 'on'+type, obj[type+fn] );
} else
obj.addEventListener( type, fn, false );
}
function removeEvent( obj, type, fn ) {
if ( obj.detachEvent ) {
@rowej83
rowej83 / breakpoints.css
Last active February 21, 2017 16:34
Mobile breakpoints including retina based off Bootstrap3 breakpoints
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),