This file contains hidden or 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
"use strict"; | |
var arr = [9, 4]; | |
var myMap = new Map(); | |
myMap.set("name", arr); | |
var newMap = new Map(myMap); |
This file contains hidden or 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
MongoDB is not magically faster. If you store the same data, organised in basically the same fashion, and access it exactly the same way, then you really shouldn't expect your results to be wildly different. After all, MySQL and MongoDB are both GPL, so if Mongo had some magically better IO code in it, then the MySQL team could just incorporate it into their codebase. | |
People are seeing real world MongoDB performance largely because MongoDB allows you to query in a different manner that is more sensible to your workload. | |
For example, consider a design that persisted a lot of information about a complicated entity in a normalised fashion. This could easily use dozens of tables in MySQL (or any relational db) to store the data in normal form, with many indexes needed to ensure relational integrity between tables. | |
Now consider the same design with a document store. If all of those related tables are subordinate to the main table (and they often are), then you might be able to model the data such that the entir |
This file contains hidden or 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 x = new Set() | |
let p = x.add(4) // x equals Set{ 4 } | |
p = x.add('nine') // x equals { 4, 'nine' } | |
p = x.delete(4) // p equals true ---- WTF ----- | |
x.delete(4) | |
p = x // p equals Set{ 'nine' } --- this is desired --- |
This file contains hidden or 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
capitalize(str=''){ | |
return str.trim().split('') | |
.map((char,i) => i === 0 ? char.toUpperCase() : char ) | |
.reduce((final,char)=> final += char, '' ) | |
} |
This file contains hidden or 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 now = '2017-10-07 16:00:00' | |
// // let now = Date.now() | |
// const timed = moment(now).format('dddd, MMMM DD YYYY HH mm ss A') | |
// const timeStamp = moment(now).valueOf() | |
// console.log(timed) | |
// console.log(timeStamp) | |
This file contains hidden or 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
Redux is verbose but gives more freedom and the app is able to maintain the component level state. | |
Relay on the other hand maps data to components from the GraphQL server and doesn't involve intermediate local data stores | |
Redux is loosely coupled with React components | |
Relay acts as a container for components and handles all data interactions to the server with built-in data fetching and caching. | |
This file contains hidden or 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
This gist is a start of the collection of little discovery moments I'll find working on my projects. |