Skip to content

Instantly share code, notes, and snippets.

View gist:f270961e672dfb5fbbe09a70606ae064
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
}
}
View csvtojson.py
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:
View sum.js
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
You can’t perform that action at this time.