$ mongo
$ show dbs
$ use myDatabase
$ show collections
$ db.myDatabase.find()
This file contains 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 randomNumber = () => { | |
return Math.random(); | |
} | |
// 1. Make it wait for 1 sec. with `setTimeout` | |
const timeoutRandomNumber = () => { | |
} | |
// 2. Now wrap the timeout version to work with promises |
This file contains 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 Sequelize = require('sequelize'); | |
const sequelize = require('../utils/db'); | |
const Console = console; | |
const Event = sequelize.define('event', { | |
info: { | |
type: Sequelize.STRING | |
}, | |
date: { | |
type: Sequelize.DATE |
This file contains 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 chai = require('chai'); | |
var chaiAsPromised = require('chai-as-promised'); | |
chai.use(chaiAsPromised); | |
chai.should(); | |
const mockStoryModel = {}; | |
const proxyquire = require('proxyquire'); | |
//creates mock model functions to replace original model functions in controller | |
const StoriesController = proxyquire('../controller/controller', |
This file contains 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 Koa = require('koa'); | |
const bodyParser = require('koa-bodyparser'); | |
const cors = require('kcors'); | |
const Console = console; | |
const app = new Koa(); | |
const router = require('./router'); | |
const db = require('./db'); | |
app |
$ git stash //stash uncommited changes
$ git log //look at your changes and choose the commit you want
$ git checkout <e2g> //where e2g is the commit no.
$ git checkout HEAD //go back to the latest commit
$ git stash pop //pop your uncommited changes
$ git add -p
$ git ls-files --others --exclude-standard //list untracked files
$ git ls-files
$ git add <untracked01.js> <untracked02.js>
$ git commit -m 'commit message'
This file contains 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
//if query is 'stephen' it will match 'stephen' and 'stephen hawking' but not 'stephen foobar' | |
//cases ignored | |
Editor.searchEditors = async (query) => { | |
const editors = await Editor.find({'name' : new RegExp(query, "gi")}); | |
if (editors) { | |
return editors; | |
} | |
}; |
This file contains 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
{ | |
"env": { | |
"browser": true, | |
"es6": true, | |
"jquery": true, | |
"node": true, | |
"mocha": true | |
}, | |
"extends": "eslint:recommended", | |
"parserOptions": { |
This file contains 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
{ | |
"env": { | |
"browser": true, | |
"es6": true, | |
"jquery": true, | |
"node": true, | |
"mocha": true | |
}, | |
"parser": "babel-eslint", | |
"extends": "eslint:recommended", |
OlderNewer