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 / App.push.js
Created February 11, 2016 15:31
JS for One Signal
App.push = (function(){
var id = '[---App ID---]';
var notificationOpenedCallback = function(jsonData) {
console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
};
var init = function(customid, callback){
id = customid ? customid : id;
@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});
});