Skip to content

Instantly share code, notes, and snippets.

View eMahtab's full-sized avatar
💭
مهتاب

Mahtab Alam eMahtab

💭
مهتاب
View GitHub Profile
@eMahtab
eMahtab / gist:3a1c1e83ccabc734b1c7
Created March 25, 2016 04:28
Loading Documents in a JavaScript Variable - A hack to create a Backup
b = db.products_bak; db.products.find().forEach( function(o){ b.insert(o) } )
// check it worked:
b.count()
@eMahtab
eMahtab / gist:935542fc0def46d8a4c8
Created March 25, 2016 04:25
MongoDB MongoImport for importing data from JSON File
mongoimport --db pcat -c products < products.json
@eMahtab
eMahtab / MongoDB-Aggregation.txt
Last active March 11, 2016 16:48
Mastering MongoDB Aggregation Framework
MongoDB comes with a great aggregation framework, which allows to write queries to fetch whatever data you might be interested into.
Before we even get into MongoDB aggreagtion and how to use it, first question is why we even need aggreagtion framework when we already have MongoDB query language and operations like find(), findOne(), limit(), skip(), sort(). The answer is aggregation framework is built into MongoDB to provide more complex analytics oriented functionality.
Lets dive into MongoDB aggregation framework and see what it have to offer.
Before getting into details of the aggreagtion framework lets see what all stages are available in MongoDB aggreation framework.
1. $match
@eMahtab
eMahtab / menu.js
Created February 24, 2016 18:15
D3 Horizontal Menu
<script>
var width=1200;
var height=640;
var canvas=d3.select("body")
.append("svg")
.attr("width",width)
.attr("height",height)
.append("g")
@eMahtab
eMahtab / invite.html
Created February 24, 2016 17:59
Uncompressed Invite Gist
var width = 1300,
height = 645
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var colorScale=d3.scale.linear().range(["green","darkgreen"])
var force = d3.layout.force()
.gravity(0.05)

A Foodys guide

'' Part of the secret of success in life is to eat what you like - Mark Twain ''

I think each one of us loves eating, yes I know some were born to overeat. In this GraphGist we will see how a graph model can bring you closer to your favourite food. I usually have 6-7 cup of tea/coffee in a day which some people call as caffeine addiction but who cares. Next we will see how Neo4j can take you to the best buffet or latte place in the city

nerd quote technology download food

The Foody Model

Below is our Foody model, each restaurant is representated by a Node. Note that Restaurants are grouped by the area, IndiraNagar have Starbucks Coffee and Beanstalk, Frazer Town have Savoury Restaurant.

@eMahtab
eMahtab / typing_text_image.html
Created December 14, 2015 18:12
Typing Text with Image
<html>
<head>
<style>
#myTypingText {
padding:12px;
color:#FFF;
font-family:Courier New, Helvetica, sans-serif;
font-size:20px;
line-height:1.5em;
}
@eMahtab
eMahtab / typing_text.html
Created December 14, 2015 14:04
JavaScript Typing Text Effect
<html>
<head>
<style>
#myTypingText {
background-color:#000;
width:700px;
height:120px;
padding:12px;
color:#FFF;
font-family:Arial, Helvetica, sans-serif;
@eMahtab
eMahtab / StringWordReversal.java
Created December 12, 2015 16:24
Reversing the order of words in String
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class StringReversal2 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String input=sc.nextLine();
@eMahtab
eMahtab / DuplicateRemoval.java
Created December 9, 2015 14:20
Removing Duplicates from an array
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class RemoveDuplicate {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int size=sc.nextInt();