Skip to content

Instantly share code, notes, and snippets.

View jaouadballat's full-sized avatar
🏠
Working from home

Jaouad Ballat jaouadballat

🏠
Working from home
View GitHub Profile
@jaouadballat
jaouadballat / frontendDevlopmentBookmarks.md
Created May 20, 2017 20:08 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const ProductSchema = new Schema({
name: String,
price: Number,
category: String,
image: String,
description: String
});
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const CategorySchema = new Schema({
title: String
});
module.exports = mongoose.model('Category', CategorySchema);
const express = require('express');
const router = express.Router();
const faker = require('faker');
const Product = require('../../models/Product');
const Category = require('../../models/Category');
router.get('/', function (req, res, next) {
const categories = ["Baby", "Movies", "Shoes", "Books", "Electronics","Computers", "Kids"];
for (let i = 0; i < 20; i++) {
let product = new Product({
const express = require('express');
const router = express.Router();
const Product = require('../models/Product');
router.get('/', function (req, res, next) {
let perPage = 3;
let page = parseInt(req.query.page) || 0;
let pages = 0;
let nextUrl = '';
const express = require('express');
const router = express.Router();
const Category = require('../models/Category');
const Product = require('../models/Product');
router.get('/', function (req, res, next) {
Category.find(function (err, categories) {
if (err) return console.log(err);
res.status(200).json(categories);
<template>
<div id="app">
<Navbar />
<router-view />
</div>
</template>
<script>
import Navbar from './components/Navbar.vue'
<template>
<nav class="navbar navbar-expand-lg navbar-light bg-light mb-3">
<div class="container">
<router-link tag="a" :to = "{name: 'home'}" class="navbar-brand">Shopping Cart</router-link>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item active" v-for="category in categories" :key="category._id">
<template>
<div>
<Cards :products="products" />
<p class="text-center mb-0">{{currentPage+1 }} / {{ pages }}</p>
<ul class="pagination justify-content-center">
<li class="page-item" :class="{disabled: prevUrl === ''}">
<button class="page-link" @click="checkPage(prevUrl)">Previous</button>
</li>
<li class="page-item" :class="{disabled: nextUrl === ''}">
<button class="page-link" @click="checkPage(nextUrl)">Next</button>
<template>
<div class="container">
<div class="row">
<div class="col-md-4 mb-3" v-for="product in products" :key="product._id">
<Card :product="product" />
</div>
</div>
</div>
</template>