TLDR: Use for...of
instead of forEach()
in asynchronous code.
For legacy browsers, use for...i
or [].reduce()
To execute the promises in parallel, use Promise.all([].map(...))
/** | |
* @param {Object} object | |
* @param {string|Array<string>} path | |
* @param {*} [defaultValue] | |
* @return {*} | |
*/ | |
export default function get(object, path, defaultValue) { | |
const path = Array.isArray(pathParam) ? pathParam : pathParam.split('.'); | |
let index = 0; |
**As a developer you have complete control over the signup and signin functionality...** | |
```shell | |
$ surreal sql --conn http://localhost:8000 --user root --pass root --ns test --db test | |
``` | |
```sql | |
-- optional : this is the default see --ns test --db test start server flags | |
-- USE NS test DB test; |
#!/bin/env node | |
let path = require('path'), fs=require('fs'); | |
function fromDir(startPath, filter, callback){ | |
if (!fs.existsSync(startPath)){ | |
console.log("no dir ",startPath); | |
return; | |
} |
<html> | |
<head> | |
<title>Html-Qrcode Demo</title> | |
<body> | |
<div id="qr-reader" style="width:500px"></div> | |
<div id="qr-reader-results"></div> | |
</body> | |
<script src="https://raw.githubusercontent.com/mebjas/html5-qrcode/master/minified/html5-qrcode.min.js"></script> | |
<script src="html5-qrcode-demo.js"></script> | |
</head> |
const io = require('socket.io-client'); | |
const socket = io('http://localhost:3000', { | |
transportOptions: { | |
polling: { | |
extraHeaders: { | |
'Authorization': 'Bearer abc', | |
}, | |
}, | |
}, |
PouchDB server is a nodejs implementation of CouchDB. Below is the steps to use AmazonRDS and NowJS to deploy your own PouchDB Server. Using MySQL as a persistent backend.
Create a Amazon Web Services Account
body { | |
font-family: tahoma; | |
color:#282828; | |
margin: 0px; | |
} | |
.nav-bar { | |
background: linear-gradient(-90deg, #84CF6A, #16C0B0); | |
height: 60px; | |
margin-bottom: 15px; |
function slugify(string) { | |
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;' | |
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------' | |
const p = new RegExp(a.split('').join('|'), 'g') | |
return string.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters | |
.replace(/&/g, '-and-') // Replace & with 'and' | |
.replace(/[^\w\-]+/g, '') // Remove all non-word characters |
function getPaginatedItems(items, page, pageSize) { | |
var pg = page || 1, | |
pgSize = pageSize || 100, | |
offset = (pg - 1) * pgSize, | |
pagedItems = _.drop(items, offset).slice(0, pgSize); | |
return { | |
page: pg, | |
pageSize: pgSize, | |
total: items.length, | |
total_pages: Math.ceil(items.length / pgSize), |