Skip to content

Instantly share code, notes, and snippets.

View shijuvar's full-sized avatar

Shiju Varghese shijuvar

View GitHub Profile
@shijuvar
shijuvar / MobileServiceRequestHelper.cs
Created May 12, 2013 09:17
A generic type Request helper class for Windows Azure Mobile Services
public class MobileServiceRequestHelper<T> where T : class
{
private string tableEndpoint;
private string applicationKey;
private HttpClient client;
public MobileServiceRequestHelper(string tableName)
{
tableEndpoint = ConfigurationManager.AppSettings["TableEndpoint"] + tableName ;
applicationKey = ConfigurationManager.AppSettings["X-ZUMO-APPLICATION"];
client = new HttpClient();
@shijuvar
shijuvar / main.go
Last active March 5, 2016 09:19
A simple HTTP server in Go
package main
import (
"fmt"
"io"
"log"
"net/http"
)
func helloHandler(res http.ResponseWriter, req *http.Request) {
@shijuvar
shijuvar / Dockerfile
Created December 17, 2014 04:11
Docker file for a Go app
# golang image where workspace (GOPATH) configured at /go.
FROM golang:latest
# Copy the local package files to the container’s workspace.
ADD . /go/src/github.com/shijuvar/golang-docker
# Build the golang-docker command inside the container.
RUN go install github.com/shijuvar/golang-docker
# Run the golang-docker command when the container starts.
@shijuvar
shijuvar / handler.go
Created January 20, 2016 07:19
http.Handler interface
type Handler interface {
ServeHTTP(ResponseWriter, *Request)
}
@shijuvar
shijuvar / main.go
Created January 20, 2016 10:07
HTTP Server with custom HTTP Handler
package main
import (
"fmt"
"log"
"net/http"
)
type indexHandler struct {
}
@shijuvar
shijuvar / main.go
Created January 20, 2016 11:25
Using HandlerFunc type as the HTTP handler
package main
import (
"fmt"
"log"
"net/http"
)
func indexHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Welcome to Go Web Development")
@shijuvar
shijuvar / main.go
Created January 20, 2016 11:50
HTTP Server with http.HandleFunc
package main
import (
"fmt"
"log"
"net/http"
)
func indexHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Welcome to Go Web Development")
@shijuvar
shijuvar / customer.proto
Created October 11, 2016 06:14
Service interface and the structure of the payload messages in Protocol Buffer
syntax = "proto3";
package customer;
// The Customer service definition.
service Customer {
// Get all Customers with filter - A server-to-client streaming RPC.
rpc GetCustomers(CustomerFilter) returns (stream CustomerRequest) {}
// Create a new Customer - A simple RPC
rpc CreateCustomer (CustomerRequest) returns (CustomerResponse) {}
@shijuvar
shijuvar / customer.pb.go
Last active October 11, 2016 08:13
Go source file generated by protoc compiler
// Code generated by protoc-gen-go.
// source: customer.proto
// DO NOT EDIT!
/*
Package customer is a generated protocol buffer package.
It is generated from these files:
customer.proto
@shijuvar
shijuvar / main.go
Created October 11, 2016 08:20
A gRPC server
package main
import (
"log"
"net"
"strings"
"golang.org/x/net/context"
"google.golang.org/grpc"