Skip to content

Instantly share code, notes, and snippets.

View Bilguun132's full-sized avatar

Batbold Bilguun Bilguun132

View GitHub Profile
const express = require('express');
const app = express();
const debug = require('debug')('myapp:server');
const path = require('path');
const multer = require('multer');
const logger = require('morgan');
const serveIndex = require('serve-index')
var storage = multer.diskStorage({
destination: (req, file, cb) => {
const express = require('express');
const debug = require('debug')('nyapp:userrouter');
const multer = require('multer');
const path = require('path');
//set the storage destination and naming
var storage = multer.diskStorage({
destination: (req, file, cb) => {
cb(null, '../public/uploads')
@Bilguun132
Bilguun132 / User.swift
Created February 22, 2019 02:28
TableView-Tutorial-User.swift
import Foundation
struct User {
let name: String
let gender: String
let email: String
}
@Bilguun132
Bilguun132 / ViewController.swift
Last active February 22, 2019 02:41
TableView-Tutorial-ViewController(no refactor)
//
// ViewController.swift
// TableViewDemo
//
// Created by Bilguun Batbold on 22/2/19.
// Copyright © 2019 ISEM. All rights reserved.
//
import UIKit
@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
@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 / 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 / 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 / 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 / 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