Skip to content

Instantly share code, notes, and snippets.

{
"name": "cra-json-server",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1"
},
"devDependencies": {
"json-server": "^0.11.2",
@up1
up1 / async.js
Last active May 1, 2024 12:52
NodeJS with Async/Await
var fetch = require('node-fetch')
async function getDataFromAPI() {
let response = await fetch("https://api.github.com/users/up1")
let data = await response.json()
console.log(JSON.stringify(data, null, "\t"))
}
getDataFromAPI()
@manniru
manniru / async.js
Created July 12, 2019 10:27 — forked from up1/async.js
NodeJS with Async/Await
var fetch = require('node-fetch')
async function getDataFromAPI() {
let response = await fetch("https://api.github.com/users/up1")
let data = await response.json()
console.log(JSON.stringify(data, null, "\t"))
}
getDataFromAPI()
@duhaime
duhaime / doors-ice.jpg
Last active May 1, 2024 12:52
Three.js Image Overlay
doors-ice.jpg
@manniru
manniru / doors-ice.jpg
Created July 11, 2019 23:15 — forked from duhaime/doors-ice.jpg
Three.js Image Overlay
doors-ice.jpg
@manniru
manniru / geo.js
Created August 5, 2019 13:15 — forked from mkhatib/geo.js
A Javascript utility function to generate number of random Geolocations around a center location and in a defined radius.
/**
* Generates number of random geolocation points given a center and a radius.
* @param {Object} center A JS object with lat and lng attributes.
* @param {number} radius Radius in meters.
* @param {number} count Number of points to generate.
* @return {array} Array of Objects with lat and lng attributes.
*/
function generateRandomPoints(center, radius, count) {
var points = [];
for (var i=0; i<count; i++) {
export default function handle(req, res) {
res.end('Hello World');
}
@manniru
manniru / database.js
Created July 22, 2019 22:46 — forked from bag-man/database.js
Connect and use MongoDB with ES6 in Node 4
'use strict'
const MongoClient = require('mongodb')
class Database {
constructor (uri) {
this.uri = uri
this.db = {}
return this
@manniru
manniru / README.md
Created July 22, 2019 21:39 — forked from rantav/README.md
MongoDB increment or insert

In mongodb it's easy to make at upsert, meaning update-or-insert by calling

db.collection.update({criteria}, {updated fields}, true)

The third parameter means - insert a new document if the document doesn't exist yet. So, for example, the following will insert a new document for the user if there's no document for that user yet, and will update it if it already exists:

 db.users.update({user_id: '1234'}, {user_id: '1234', name: 'Ran'}, true)
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import clsx from "clsx";
import Card from "@material-ui/core/Card";
import CardHeader from "@material-ui/core/CardHeader";
import CardMedia from "@material-ui/core/CardMedia";
import CardContent from "@material-ui/core/CardContent";
import CardActions from "@material-ui/core/CardActions";
import Collapse from "@material-ui/core/Collapse";
import Avatar from "@material-ui/core/Avatar";