- An alternative approach to RESTful APIs
- Clients issue queries/mutations to read and update data
- Clients can fetch only the entity fields that are required
- GraphQL query syntax can express complex entity relations => nested objects
- Mitigates the explosion of RESTful endpoints in scenarios where many different representations of an entity are needed
- Graphiql is a query execution UI, also provides good documentation
var request = require('request'); | |
var unzip = require('unzip'); | |
var csv2 = require('csv2'); | |
request.get('http://s3.amazonaws.com/alexa-static/top-1m.csv.zip') | |
.pipe(unzip.Parse()) | |
.on('entry', function (entry) { | |
entry.pipe(csv2()).on('data', console.log); | |
}) | |
; |
import React, {useCallback, useRef} from 'react' | |
function useHookWithRefCallback() { | |
const ref = useRef(null) | |
const setRef = useCallback(node => { | |
if (ref.current) { | |
// Make sure to cleanup any events/references added to the last instance | |
} | |
if (node) { |
[ | |
{ | |
"institution": "Alabama A & M University" | |
}, | |
{ | |
"institution": "University of Alabama at Birmingham" | |
}, | |
{ | |
"institution": "Amridge University" | |
}, |
SQL to MongoDB Mapping Chart¶
In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.
Executables¶
The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.
// Trie.js - super simple JS implementation | |
// https://en.wikipedia.org/wiki/Trie | |
// ----------------------------------------- | |
// we start with the TrieNode | |
function TrieNode(key) { | |
// the "key" value will be the character in sequence | |
this.key = key; | |
At October 11, 2019, I published a Javascript library to to run the resumable upload for Google Drive. When this is used, the large file can be uploaded. You can also use this js library.
This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create()
can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.
- This sample uses gapi.
- Before you use this, please enable Drive API at API console and carr
/** | |
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
* It was requested to be introduced at as part of the jsonwebtoken library, | |
* since we feel it does not add too much value but it will add code to mantain | |
* we won't include it. | |
* | |
* I create this gist just to help those who want to auto-refresh JWTs. | |
*/ | |
const jwt = require('jsonwebtoken'); |
[ | |
{'city': 'Abbeville', 'state': 'Louisiana'}, | |
{'city': 'Aberdeen', 'state': 'Maryland'}, | |
{'city': 'Aberdeen', 'state': 'Mississippi'}, | |
{'city': 'Aberdeen', 'state': 'South Dakota'}, | |
{'city': 'Aberdeen', 'state': 'Washington'}, | |
{'city': 'Abilene', 'state': 'Texas'}, | |
{'city': 'Abilene', 'state': 'Kansas'}, |
/* ******************************************************************************************* | |
* THE UPDATED VERSION IS AVAILABLE AT | |
* https://github.com/LeCoupa/awesome-cheatsheets | |
* ******************************************************************************************* */ | |
// 0. Synopsis. | |
// http://nodejs.org/api/synopsis.html |