This file contains hidden or 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
| // | |
| // ChatsViewController.swift | |
| // FakeChat | |
| // | |
| // Created by Bilguun Batbold on 23/3/19. | |
| // Copyright © 2019 Bilguun. All rights reserved. | |
| // | |
| import UIKit |
This file contains hidden or 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
| // | |
| // ChatMessageCell.swift | |
| // FakeChat | |
| // | |
| // Created by Bilguun Batbold on 23/3/19. | |
| // Copyright © 2019 Bilguun. All rights reserved. | |
| // | |
| import Foundation | |
| import UIKit |
This file contains hidden or 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
| // | |
| // ViewController.swift | |
| // FakeChat | |
| // | |
| // Created by Bilguun Batbold on 23/3/19. | |
| // Copyright © 2019 Bilguun. All rights reserved. | |
| // | |
| import UIKit | |
| import NotificationCenter |
This file contains hidden or 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
| import requests | |
| from bs4 import BeautifulSoup | |
| import csv | |
| page = requests.get('https://github.com/trending') | |
| # Create a BeautifulSoup object | |
| soup = BeautifulSoup(page.text, 'html.parser') | |
| # get the repo list |
This file contains hidden or 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
| import requests | |
| from bs4 import BeautifulSoup | |
| page = requests.get('https://github.com/trending') | |
| # Create a BeautifulSoup object | |
| soup = BeautifulSoup(page.text, 'html.parser') | |
| # get the repo list |
This file contains hidden or 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
| import requests | |
| from bs4 import BeautifulSoup | |
| page = requests.get('https://github.com/trending') | |
| # Create a BeautifulSoup object | |
| soup = BeautifulSoup(page.text, 'html.parser') | |
| # get the repo list |
This file contains hidden or 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
| const config = require("config"); | |
| const mongoose = require("mongoose"); | |
| const usersRoute = require("./routes/user.route"); | |
| const express = require("express"); | |
| const app = express(); | |
| //use config module to get the privatekey, if no private key set, end the application | |
| if (!config.get("myprivatekey")) { | |
| console.error("FATAL ERROR: myprivatekey is not defined."); |
This file contains hidden or 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
| const auth = require("../middleware/auth"); | |
| const bcrypt = require("bcrypt"); | |
| const { User, validate } = require("../models/user.model"); | |
| const express = require("express"); | |
| const router = express.Router(); | |
| router.get("/current", auth, async (req, res) => { | |
| const user = await User.findById(req.user._id).select("-password"); | |
| res.send(user); | |
| }); |
This file contains hidden or 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
| const jwt = require("jsonwebtoken"); | |
| const config = require("config"); | |
| module.exports = function(req, res, next) { | |
| //get the token from the header if present | |
| const token = req.headers["x-access-token"] || req.headers["authorization"]; | |
| //if no token found, return response (without going to the next middelware) | |
| if (!token) return res.status(401).send("Access denied. No token provided."); | |
| try { |
This file contains hidden or 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
| const config = require('config'); | |
| const jwt = require('jsonwebtoken'); | |
| const Joi = require('joi'); | |
| const mongoose = require('mongoose'); | |
| //simple schema | |
| const UserSchema = new mongoose.Schema({ | |
| name: { | |
| type: String, | |
| required: true, |