Skip to content

Instantly share code, notes, and snippets.

View mulhoon's full-sized avatar
💻
building withcabin.com

Nic Mulvaney mulhoon

💻
building withcabin.com
View GitHub Profile
@mulhoon
mulhoon / validate.js
Last active August 29, 2015 14:05
Validate email address
var validateEmail = function(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
};
@mulhoon
mulhoon / animation.js
Last active August 29, 2015 14:02
Timeline a VelocityJS animation
// requires underscore or lodash + velocity + jquery
var animation = {
play:function(sequence, complete){
_.each(sequence, function(o){
var el = $(o.el);
el.attr('style','');
_.each(o.timeline, function(a, i){
el.velocity(a, {delay:a.delay, complete:a.end ? complete : null});
});
@mulhoon
mulhoon / templateEngine.php
Last active February 18, 2018 22:18
Simple PHP Template engine
<?php
/*
Original by Rasmus Larsson
http://www.rasmuslarsson.se/2013/05/a-template-engine-in-php/
*/
class Template
{
protected $template;