Skip to content

Instantly share code, notes, and snippets.

View siliconsenthil's full-sized avatar

Senthil V S siliconsenthil

View GitHub Profile
@siliconsenthil
siliconsenthil / kafka_setup_mac.md
Last active November 30, 2022 15:15
Install Kafka in Mac

Installation

brew tap adoptopenjdk/openjdk


brew cask install adoptopenjdk14
brew cask install homebrew/cask-versions/adoptopenjdk8
public boolean decide(int s){
boolean result = false;
if (s == 1){
result = true;
}else{
result = false;
}
return result;
}

Keybase proof

I hereby claim:

  • I am siliconsenthil on github.
  • I am siliconsenthil (https://keybase.io/siliconsenthil) on keybase.
  • I have a public key ASAvhTD5DMpraRaQA4HG0VBg896VGrlFVC6VLtTDMRpLJgo

To claim this, I am signing this object:

class CommentsController < ApplicationController
def create
event_user = EventUser.find(params[:event_user_id])
comment = Comment.create(:event_user => event_user, :text => params[:text])
FayeClient.broadcast("/event_#{event_user.event_id}_comments", comment.as_json)
render :text => 'Success'
end
end
##############################
@siliconsenthil
siliconsenthil / gist:7549154
Last active December 28, 2015 19:19
This code is after moving logic to model
class CommentsController < ApplicationController
def create
Comment.create(params[:comment])
render :text => 'Success'
end
end
#################################################
class Comment < ActiveRecord::Base
@siliconsenthil
siliconsenthil / IterationRecursionTailRecursion.scala
Created February 15, 2013 09:39
Understanding the differences between Iteraion, Recursion and Tail Recursion using a Scala example.
object RecursionVsTailRecursion extends App {
def iterative_sum(a: Long, b: Long):Long = {
var result = 0L;
for(i <- a until b){result=result+i}
return result+b;
}
def sum(a: Long, b: Long): Long = if(a > b) 0 else a + sum(a+1, b)