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 mongoose = require('mongoose'); | |
const validator = require('validator'); | |
mongoose.connect('mongodb://127.0.0.1:27017/task-manager-api', { | |
useNewUrlParser: true, | |
useUnifiedTopology: true, | |
useCreateIndex: true, | |
}); | |
// const User = mongoose.model('User', { |
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 mongodb = require('mongodb'); | |
const MongoClient = mongodb.MongoClient; | |
const connectionURL = 'mongodb://127.0.0.1:27017'; | |
const databaseName = 'task-manager'; | |
MongoClient.connect( | |
connectionURL, | |
{ | |
useNewUrlParser: true, |
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
let i = 0; | |
let intervalId = setInterval(() => { | |
if (i === 10) { | |
clearInterval(intervalId); | |
} | |
// or | |
// if (i === 10) { | |
// return; | |
// } |
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
let max_of_array = Math.max.apply(Math, array); |
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
/etc/apache2/sites-available/000-default.conf | |
<VirtualHost *:80> | |
ServerAdmin admin@example.com | |
DocumentRoot /var/www/html | |
ServerName example.com | |
ServerAlias www.example.com | |
<Directory /var/www/html/wordpress/> |
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
/*! debug.css | MIT License | https://gist.github.com/zaydek/6b2e55258734deabbd2b4a284321d6f6 */ | |
// Declaration inside file | |
<style> | |
[debug], [debug] *:not(g):not(path) { | |
color: hsla(210, 100%, 100%, 0.9) !important; | |
background: hsla(210, 100%, 50%, 0.5) !important; | |
outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; |
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
async function loadJson(url) { | |
let response = await fetch(url); | |
if (response.status == 200) { | |
let json = await response.json(); | |
return json; | |
} | |
throw new Error(response.status); | |
} |
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
https://marketplace.visualstudio.com/items?itemName=sdras.vue-vscode-extensionpack | |
Vetur | |
Vue 2 Snippets | |
vscode-material-ui-snippets | |
Vue Peek | |
Vue.js Extension Pack (https://marketplace.visualstudio.com/items?itemName=mubaidr.vuejs-extension-pack) | |
Install CLI |
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
// let re = /hello/; | |
// let re = /hello/i; | |
// let re = /hello/g; | |
// i - 'case insensitive' | |
// g - 'search all matches' | |
// console.log(re); | |
// console.log(re.source); | |
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
import { createStore, applyMiddleware, compose } from "redux"; | |
import thunk from "redux-thunk"; | |
import rootReducer from "./reducers"; | |
const initialState = {}; | |
const middleware = [thunk]; | |
const store = createStore( | |
rootReducer, |
NewerOlder