Skip to content

Instantly share code, notes, and snippets.

View devbyray's full-sized avatar
:octocat:
Building cool things!

Dev By Ray devbyray

:octocat:
Building cool things!
View GitHub Profile
@devbyray
devbyray / sass-extend.css
Created December 23, 2014 12:07
Sass extend
.message, .success, .error {
border: 1px solid #ccc;
padding: 10px;
color: #333;
}
.success {
border-color: green;
}
@devbyray
devbyray / sass-math.css
Last active August 29, 2015 14:12
Sass math
.container {
width: 100%;
}
article[role="main"] {
float: left;
width: 62.5%;
}
aside[role="complimentary"] {
@devbyray
devbyray / sass-placeholder-class.css
Last active August 29, 2015 14:12
Sass placeholder class
.container {
/**
**This is an placeholder class
**/
display: block;
margin-left: auto;
margin-right: auto;
}
.center, .container {
@devbyray
devbyray / mobileCheck.js
Created January 8, 2015 12:07
Function to check if Mobile Device (Android, WebOS, iPhone, iPad, iPod (or iOS), Windows Phone, SymbianOS, RIM)
(function () {
'use strict';
var useragent = navigator.userAgent;
function deviceOS() {
if(useragent.match(/Android/i)) {
return 'android';
} else if(useragent.match(/webOS/i)) {
@devbyray
devbyray / Sublime snippet default
Last active August 29, 2015 14:14
Sublime snippet default
<snippet>
<content><![CDATA[
Here is the place for you're code!
Hello, ${1:this} is a ${2:snippet}.
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
@devbyray
devbyray / Sublime selff snippet
Created January 29, 2015 09:00
Sublime selff snippet
<snippet>
<content><![CDATA[
(function() {
'use strict';
var ${1:function_name} = function() {
var ${1:function_name} = "abc";
return ${1:function_name};
}
@devbyray
devbyray / Sublime tabtrigger
Created January 29, 2015 09:05
Sublime tabtrigger
<tabTrigger>hello</tabTrigger>
<scope>source.js</scope>
@devbyray
devbyray / email-validation.module.js
Created February 18, 2015 08:49
Vanilla JavaScript emailValidation Module
var emailValidation = (function(emailValidation) {
'use strict';
var emailValidator, emailIsValid, addClass, removeClass, hasClass, removeElement, classListSupport, eleValue, isNotEmpty, emailRegex, validateErrorElClass,
validateErrorEl, formContainerEl, defaults, parent, validateElClass, result, atCharIndex, pointCharIndex;
emailValidation.defaults = {
formContainer: ".email-conformation",
valElementClass: "email-validation-error",
errorMessage: "Dit is geen geldig emailadres",
@devbyray
devbyray / validate.js
Created March 20, 2015 14:18
validate best practice
var validator = (function(validator) {
// variables including form, inputfield names(html - > name), _validate starting point
var errorElement, firstNameField, lastNameField, messageField, emailField, inputFields, firstNameError, lastNameError, emailError, msgError, emailRegEx, err, _showError, _getElValue, _hideErrorElement, _validate, totalInputFields,
form = document.getElementById('nawForm'),
inputName = form.querySelectorAll(['input[name="firstName"],input[name="lastName"],input[name="email"],textarea[name="msg"]']),
_validateOnKey = false;
/**
* Show or hide error of the input field