Skip to content

Instantly share code, notes, and snippets.

View ParthDesai's full-sized avatar
🏠
Working from home

Parth ParthDesai

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am parthdesai on github.
  • I am desaiparth08 (https://keybase.io/desaiparth08) on keybase.
  • I have a public key ASDTq-PJyPos_b9HsnoE61ms-8t2_iKPMlDdZtLf1TJajgo

To claim this, I am signing this object:

package main
import (
"errors"
"log"
"net"
"net/http"
"net/rpc"
"shared" //Path to the package contains shared struct
package main
import (
"fmt"
"log"
"net/rpc"
"shared" //Path to the package contains shared struct
)
package main
import (
"fmt"
"log"
"net"
"net/rpc"
"shared" //Path to the package contains shared struct
)
package main
import (
"errors"
"log"
"net"
"net/rpc"
"shared" //Path to the package contains shared struct
)
package shared
type Arith interface {
Multiply(args *Args, reply *int) error
Divide(args *Args, quo *Quotient) error
}
package shared
type Args struct {
A, B int
}
type Quotient struct {
Quo, Rem int
}
package main
import (
"shared" //Path to the package contains shared struct
)
// Every method that we want to export must have
// (1) the method has two arguments, both exported (or builtin) types
// (2) the method's second argument is a pointer
// (3) the method has return type error
@ParthDesai
ParthDesai / Mocha test demo
Created September 21, 2015 04:22
A sample test using mocha and chai. To execute, add it into your directory and make sure file name contains a string "test".
'use strict';
var chai = require('chai');
var expect = chai.expect;
describe('Array', function() {
describe('#indexOf()', function () {
it('should return -1 when the value is not present', function () {
expect([1,2,3].indexOf(5)).to.equal(-1);
@ParthDesai
ParthDesai / funcProgramming.go
Last active September 8, 2015 15:51
Functional programming in go
package main
import "fmt"
type predicate func(int) bool
func main() {
r := filter([]int{1, 2, 3, 4}, func(x int) bool {
return x%2 == 0
})