Skip to content

Instantly share code, notes, and snippets.

@gaurav-gogia
gaurav-gogia / Mongo.go
Created December 20, 2016 14:47 — forked from p4tin/Mongo.go
Golang Mongo CRUD Example
package mongo
import (
"time"
"log"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
// Profile - is the memory representation of one user profile
@gaurav-gogia
gaurav-gogia / .Title
Created September 14, 2017 20:21 — forked from congjf/.Title
Using MongoDB in golang with mgo
Using MongoDB in golang with mgo
@gaurav-gogia
gaurav-gogia / explanation.md
Created November 13, 2017 16:02 — forked from markrendle/explanation.md
Why I am not a fan of Apache Kafka

Update, September 2016

OK, you can pretty much ignore what I wrote below this update, because it doesn't really apply anymore.

I wrote this over a year ago, and at the time I had spent a couple of weeks trying to get Kafka 0.8 working with .NET and then Node.js with much frustration and very little success. I was rather angry. It keeps getting linked, though, and just popped up on Hacker News, so here's sort of an update, although I haven't used Kafka at all this year so I don't really have any new information.

In the end, we managed to get things working with a Node.js client, although we continued to have problems, both with our code and with managing a Kafka/Zookeeper cluster generally. What made it worse was that I did not then, and do not now, believe that Kafka was the correct solution for that particular problem at that particular company. What they were trying to achieve could have been done more simply with any number of other messaging systems, with a subscriber reading messages off and writing

@gaurav-gogia
gaurav-gogia / Animal.jsx
Created May 18, 2018 11:58
Trying to use mapDispatchToProps without mapStateToProps. See this is what I'm trying but it keeps giving me this error: TypeError: dispatch is not a function
import '../App.css'
import {connect} from 'react-redux';
import React, {Component} from 'react';
import {bindActionCreators} from 'redux';
import {selectAnimal} from '../actions/actions';
class Animal extends Component {
onClick = () => this.props.selectAnimal(this.props.animalInfo);
render() {
return (
@gaurav-gogia
gaurav-gogia / MainActivity.cs
Created May 22, 2018 19:19
Trying to use "FusedLocationProviderClient" in Xamarin.Android to get user location.
using Android.Locations;
using Android.App;
using Android.OS;
using Android.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
using Android.Util;
using Android.Widget;
using Android.Gms.Common;
@gaurav-gogia
gaurav-gogia / actions.js
Last active May 27, 2018 18:42
How do I use async/await functions in actions?
import axios from 'axios';
import {ACTION_TYPES, URL} from '../constants';
export const getAnimals = () => {
//code for use below async function to get the data and use it as payload
return {
type: ACTION_TYPES.GET_ANIMALS,
payload: {}
}
}
package main
import (
"fmt"
"time"
)
func main() {
var n int
@gaurav-gogia
gaurav-gogia / DataForm.jsx
Last active July 27, 2018 21:55
handling async actions with react, redux, react-redux & redux-thunk
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import React, { Component } from 'react';
import { ACTION_TYPES } from '../../constants';
import { createLink } from '../../actions/actions';
class DataForm extends Component {
constructor(props) {
super(props);
this.state = {
@gaurav-gogia
gaurav-gogia / index.html
Created July 20, 2018 12:07
exploring vue
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.jsdelivr.net/npm/@aspnet/signalr@1.0.2/dist/browser/signalr.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>SignalR 2018</title>
@gaurav-gogia
gaurav-gogia / inspection.json
Created July 27, 2018 21:54
docker inspection
[
{
"Id": "66bd56ebc3a19c717b722e314efdddb3703c27120bbd79d3867cace1d6bd2787",
"Created": "2018-07-27T21:52:34.387739635Z",
"Path": "/sbin/tini",
"Args": [
"-g",
"--",
"/docker-entrypoint.sh",
"neo4j"