This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(sequelize, DataTypes) { | |
//note: jQuery validation rules applied at clientside should sync with this | |
var User = sequelize.define('User', | |
{ | |
user_id: { | |
type: DataTypes.INTEGER, | |
primaryKey: true | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(sequelize, DataTypes) { | |
//note: jQuery validation rules applied at clientside should sync with this | |
var User = sequelize.define('User', | |
{ | |
userId: { | |
type: DataTypes.INTEGER, | |
primaryKey: true, | |
allowNull: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timeHasLapsed = ''; | |
function timeLapse() { | |
var secondsLapsed = timeHasLapsed / 1000; | |
//1 SECOND lapsed | |
timeHasLapsed = '1 second ago'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***** models/index.js */ | |
var fs = require('fs') | |
, path = require('path') | |
, Sequelize = require('sequelize') | |
, lodash = require('../node_modules/sequelize/node_modules/lodash') | |
//'name','username','password' | |
, sequelize = new Sequelize('postgres', 'postgres', 'password' | |
,{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(req.body.action == 'unlike') { | |
//using find a | |
db.Like.findAll({ | |
where: db.Sequelize.and( | |
{Post_postId: req.body.postId}, | |
{User_userId: req.user.userId} | |
) | |
}).then(function(likes) { | |
console.log(likes); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
req.user.hasFollow(userIdToAction).then(function(user) { | |
console.log(user); | |
if(!user) { | |
return req.user.addFollow(userIdToAction) | |
.then(function(){ | |
res.json({success:true}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gm(rawPath).noProfile().autoOrient() | |
//parse the stream for async saving. | |
.stream(function(err, stdout, stderr) { | |
if(err) { | |
console.log('Stream error...'); | |
console.log(err); | |
return res.json({success: false}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "hashionable", | |
"version": "0.0.1", | |
"private": true, | |
"scripts": { | |
"start": "node ./bin/www" | |
}, | |
"dependencies": { | |
"async": "0.9.0", | |
"bcrypt-nodejs": "0.0.3", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en" class="no-js" ><!--<![endif]--> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>{title}</title> | |
<meta name="description" content="Description."> | |
<meta name="keywords" content=""> | |
<meta name="author" content=""> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.validator.addMethod( | |
"regex", | |
function(value, element, regexp) { | |
var re = new RegExp(regexp); | |
return this.optional(element) || re.test(value); | |
} | |
); | |
$('#signupForm').validate({ | |
rules: { | |
username: { |
OlderNewer