Skip to content

Instantly share code, notes, and snippets.

View siddharthlatest's full-sized avatar

Siddharth Kothari siddharthlatest

View GitHub Profile
var React = require('react');
var UserImg = require('./userImg.jsx');
//User component
var User = React.createClass({
HIGHLIGHT_TAGS: function(group_topics) {
var highlight_tags = [];
var group_topics = group_topics;
var highlight = this.props.TOPIC_LIST;
var React = require('react');
var UserImg = React.createClass({
componentDidMount: function() {
var self = this;
this.img = new Image();
var defaultSrc = 'http://www.avidog.com/wp-content/uploads/2015/01/BellaHead082712_11-50x65.jpg';
this.img.onerror = function() {
if (self.isMounted()) {
self.setState({
@siddharthlatest
siddharthlatest / aggregations.md
Created November 14, 2016 07:29
Aggregations

Aggregations

Run on mirage_test

1. Metrics Aggregations

1.1 Avg Aggregation

Single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents.

@siddharthlatest
siddharthlatest / GET _search.js
Last active December 26, 2016 20:59
_search action
{
"query" : {
"bool" : {
"filter" : {
"term" : {
"city" : "London"
}
}
}
},
{
sensorId: "SingleListFilter",
appbaseField: "db.field",
showSearch: {true}
}
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 2,
{
"took": 35,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 211,
[
{
"album": "The White Stripes",
"year": 1999,
"US_peak_chart_post": "-"
},
{
"album": "De Stijl",
"year": 2000,
"US_peak_chart_post": "-"
@siddharthlatest
siddharthlatest / App.js
Last active January 3, 2018 01:57
booksearch app UI
import React, { Component } from 'react';
import {
ReactiveBase,
DataSearch,
SingleRange,
ResultCard
} from '@appbaseio/reactivesearch';
import './App.css';
class App extends Component {
@siddharthlatest
siddharthlatest / App.css
Created January 3, 2018 01:58
booksearch app styles
.navbar {
width: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 1;
display: flex;
align-items: center;
background-color: #0B6AFF;
color: #fff;