Skip to content

Instantly share code, notes, and snippets.


kamal namdeo kamal-github

Block or report user

Report or block kamal-github

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kamal-github / graceful.go
Created Apr 1, 2018 — forked from peterhellberg/graceful.go
*http.Server in Go 1.8 supports graceful shutdown. This is a small example.
View graceful.go
package main
import (
View redis_pubsub_demo.rb
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
View concurrent-non-redundant-non-blocking-cache.go
// Func is the type of the function to memoize.
type Func func(key string) (interface{}, error)
type result struct {
value interface{}
err error
type entry struct {
res result
View gist:95f44c7fe22225c7b5cd59bce400355a
type T struct {
A int
B string
t := T{23, "skidoo"}
s := reflect.ValueOf(&t).Elem()
typeOfT := s.Type()
for i := 0; i < s.NumField(); i++ {
kamal-github / program-for-array-rotation-continued-reversal-algorithm
Created Mar 27, 2017
View program-for-array-rotation-continued-reversal-algorithm
#ex array
def rev_rotation_by_d(a, d)
d.times do
a << a.shift
def rotation_by_d(a, d)
d.times do
View jpaContext.xml
<beans xmlns=""
<context:annotation-config />
<context:component-scan base-package="com.lorem.Todo" />
kamal-github / gist:b89802cc06b1fae85666fa0028b9526a
Created Aug 25, 2016
Include this module to make your class instance variable accessible to subclass which doesn't declare that variable(ref -
View gist:b89802cc06b1fae85666fa0028b9526a
module ClassLevelInheritableAttributes
def self.included(base)
module ClassMethods
def inheritable_attributes(*args)
@inheritable_attributes ||= [:inheritable_attributes]
@inheritable_attributes += args
args.each do |arg|
View sneakers.rb
require 'sneakers'
Sneakers.configure heartbeat: 5,
amqp: ENV['RABBITMQ_BIGWIG_URL'] || 'amqp://guest:guest@localhost:5672/order',
workers: 1,
timeout_job_after: 60,
threads: 5,
prefetch: 5,
after_fork: { ActiveRecord::Base.establish_connection },
durable: true
View rails snippets
snippet art
assert_redirected_to ${1:action}: '${2:index}'
snippet artnp
assert_redirected_to ${1:parent}_${2:child}_path(${3:@$1}, ${0:@$2})
snippet artnpp
assert_redirected_to ${1:parent}_${2:child}_path(${0:@$1})
snippet artp
assert_redirected_to ${1:model}_path(${0:@$1})
snippet artpp
assert_redirected_to ${0:model}s_path
You can’t perform that action at this time.