Skip to content

Instantly share code, notes, and snippets.

View gulshanzealous's full-sized avatar

Gulshan Sharma gulshanzealous

View GitHub Profile
"use strict";
var arr = [9, 4];
var myMap = new Map();
myMap.set("name", arr);
var newMap = new Map(myMap);
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
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 ---
capitalize(str=''){
return str.trim().split('')
.map((char,i) => i === 0 ? char.toUpperCase() : char )
.reduce((final,char)=> final += char, '' )
}
// 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)
@gulshanzealous
gulshanzealous / gist:22bc2eae464d4533107bcc5ad0a50ac8
Created September 18, 2017 06:45
Comparison between Redux and Relay
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.
@gulshanzealous
gulshanzealous / FirstGist.txt
Last active September 6, 2017 04:13
A sample Gist
This gist is a start of the collection of little discovery moments I'll find working on my projects.