Skip to content

Instantly share code, notes, and snippets.

View deanshub's full-sized avatar

Dean Shub deanshub

View GitHub Profile
@deanshub
deanshub / gist:4613152
Last active December 11, 2015 14:18
javascript: browser detect
Detect Safari (if( $.browser.safari)),
Detect IE6 and over (if ($.browser.msie && $.browser.version > 6 )),
Detect IE6 and below (if ($.browser.msie && $.browser.version <= 6 )),
Detect FireFox 2 and above (if ($.browser.mozilla && $.browser.version >= '1.8' ))
@deanshub
deanshub / route.js
Created August 25, 2014 12:38 — forked from beshur/route.js
app.post('/login', function(req, res) {
console.log(res);
passport.authenticate('local', function(err, user, params) {
if (req.xhr) {
//thanks @jkevinburton
if (err) { return res.json({ error: err.message }); }
// e.g. in auth.js:
// if (!user.emailVerified) { return done(null, false, { message: 'Email is not verified. Please check your email for the link.' }); }
if (!user && params) { return res.json({error : params.error}); }