Skip to content

Instantly share code, notes, and snippets.

View Bilguun132's full-sized avatar

Batbold Bilguun Bilguun132

View GitHub Profile
@Bilguun132
Bilguun132 / console.log
Created February 23, 2019 18:52
MongoDemo-Tutorial-QueryOperations
Connected to MongoDB...
{ genre: [ 'action, adventure, fantasy' ],
releaseDate: 2019-02-23T18:50:55.357Z,
_id: 5c71960ff3e891294bf8c218,
name: 'Avengers',
director: 'Joss Whedon',
price: 10,
__v: 0 }
{ genre: [ 'animation, action, adventure' ],
releaseDate: 2019-02-23T18:50:55.357Z,
@Bilguun132
Bilguun132 / index.js
Last active February 23, 2019 18:51
MongoDemo-Tutorial-Index.js with queries
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/demo', { useNewUrlParser: true })
.then(() => console.log('Connected to MongoDB...'))
.catch((err) => console.error('Could not connect to MongoDB...', err));
//create MovieSchema
const movieSchema = new mongoose.Schema({
@Bilguun132
Bilguun132 / index.js
Created February 23, 2019 18:03
MongoDemo-Tutorial-Index.js with schema
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/demo', {useNewUrlParser: true})
.then(()=> console.log('Connected to MongoDB...'))
.catch((err) => console.error('Could not connect to MongoDB...', err));
//create MovieSchema
const movieSchema = new mongoose.Schema({
@Bilguun132
Bilguun132 / index.js
Created February 23, 2019 17:38
MongoDemo-Tutorial-Index.js connect to mongoDb
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/demo', {useNewUrlParser: true})
.then(()=> console.log('Connected to MongoDB...'))
.catch((err) => console.error('Could not connect to MongoDB...', err));
@Bilguun132
Bilguun132 / User.swift
Last active July 10, 2021 15:41
TableView-Tutorial-Alphabetical Index
//
// User.swift
// TableViewDemo
//
// Created by Bilguun Batbold on 22/2/19.
// Copyright © 2019 ISEM. All rights reserved.
//
import Foundation
@Bilguun132
Bilguun132 / ViewController.swift
Last active February 22, 2019 03:48
TableView-Tutorial-ViewControllerFinal
import UIKit
class ViewController: UIViewController {
private let refreshControl = UIRefreshControl()
//declare an outlet and connect to the tableview previously created
@IBOutlet weak var usersTableView: UITableView!
@Bilguun132
Bilguun132 / ViewController.swift
Last active February 22, 2019 03:33
TableView-Tutorial-ViewControllerRefacored
import UIKit
class ViewController: UIViewController {
//declare an outlet and connect to the tableview previously created
@IBOutlet weak var usersTableView: UITableView!
private var userManager = UserManager()
//initialize after self is available
@Bilguun132
Bilguun132 / UserDataSourceProvider.swift
Last active February 22, 2019 03:27
TableView-Tutorial-UserDataSourceProvider
import Foundation
import UIKit
public class UserDataSourceProvider: NSObject, UITableViewDelegate, UITableViewDataSource {
//private var to hold the user manager
private let userManager: UserManager
//initialize the user manager
@Bilguun132
Bilguun132 / User.swift
Created February 22, 2019 03:25
TableView-Tutorial-User.swift with manager
import Foundation
public struct User {
let name: String
let gender: String
let email: String
}
public class UserManager {
@Bilguun132
Bilguun132 / UserTableViewCell.swift
Created February 22, 2019 03:03
TableView-Tutorial-TableViewCell.swift
//
// UserView.swift
// TableViewDemo
//
// Created by Bilguun Batbold on 22/2/19.
// Copyright © 2019 ISEM. All rights reserved.
//
import Foundation
import UIKit