Skip to content

Instantly share code, notes, and snippets.

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
},
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,
var timeHasLapsed = '';
function timeLapse() {
var secondsLapsed = timeHasLapsed / 1000;
//1 SECOND lapsed
timeHasLapsed = '1 second ago';
/***** 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'
,{
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);
req.user.hasFollow(userIdToAction).then(function(user) {
console.log(user);
if(!user) {
return req.user.addFollow(userIdToAction)
.then(function(){
res.json({success:true});
});
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});
}
@calvintwr
calvintwr / gist:21f13462147509d068f6
Created October 14, 2014 04:48
iOS Safari problem: package JSON
{
"name": "hashionable",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"async": "0.9.0",
"bcrypt-nodejs": "0.0.3",
<!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="">
$.validator.addMethod(
"regex",
function(value, element, regexp) {
var re = new RegExp(regexp);
return this.optional(element) || re.test(value);
}
);
$('#signupForm').validate({
rules: {
username: {