Skip to content

Instantly share code, notes, and snippets.

View deathping1994's full-sized avatar

Gaurav Shukla deathping1994

View GitHub Profile
response = {}
someAsyncCall().then(function(rows){
_.forEach(rows, function(row){
if(typeof response[row.key] === 'undefined'){
response[row.key] = {count1:0,count2: row.count}
}
else{
response[row.key][count2]+=row.count
}
}
from elasticsearch import Elasticsearch
import re
es = Elasticsearch([{'host': 'localhost', 'port': 9200}])
csvfile=open("/home/gaurav/Affiliate_feed.csv","r")
fields=csvfile.readline()
fields=fields.split(",")
jsonobj={}
i=0
for line in csvfile:
var add=function()
{
if(arguments.length==0)
{return 0
}
else{
let args=[].slice.call(arguments,0)
args.splice(0,1)
return arguments[0]+add.apply(this,args)//needtoreadaboutapply