Skip to content

Instantly share code, notes, and snippets.

View akshaymohite's full-sized avatar

Akshay Mohite akshaymohite

View GitHub Profile
[alias]
st = status
di = diff
co = checkout
ci = commit
br = branch
sta = stash
llog = log --date=local
flog = log --pretty=fuller --decorate
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
@akshaymohite
akshaymohite / pluck-behaviour-in-rails-5.rb
Created July 12, 2017 06:45
Pluck behaviour in Rails 5
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails", tag: 'v5.0.0'
@akshaymohite
akshaymohite / pluck-behaviour-in-rails-4.rb
Last active July 12, 2017 06:45
Pluck behaviour in Rails 4
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails", tag: 'v4.2.6'
@akshaymohite
akshaymohite / kubernetes-command.md
Created July 10, 2017 07:01
Helpful Kubernetes Commands

Helpful Kubernetes Commands

Get POD Name

kubectl get pods

Server Login

kubectl exec -it pod-name -- /bin/bash
@akshaymohite
akshaymohite / web-socket-test-local.html
Created June 14, 2017 10:11
Websocket Test on Local on Rails ActionCable
<!DOCTYPE html>
<meta charset="utf-8" />
<title>WebSocket Test</title>
<script language="javascript" type="text/javascript">
var wsUri = "ws://localhost:3000/cable";
var output;
function init()
{
@akshaymohite
akshaymohite / between-member-include-benchmark.rb
Last active May 12, 2017 08:32
Benchmark between member include in Ruby
Benchmark.bmbm do |x|
x.report { 100000000.times{ 14.between?(10,20)}}
x.report{ 100000000.times{(10..20).member?(14)}}
x.report{ 100000000.times{(10..20).include?(14)}}
end
# result
# Rehearsal ------------------------------------
# 14.030000 0.010000 14.040000 ( 14.028154)
@akshaymohite
akshaymohite / awesome_print_output.rb
Created April 30, 2017 05:29
Awesome Print output
a = {:a =>[1,2,3], :b => 'Sample String'}
# {
# :a => [
# [0] 1,
# [1] 2,
# [2] 3
# ],
# :b => "Sample String"
# }
@akshaymohite
akshaymohite / awesome_print_demo.rb
Created April 30, 2017 05:27
Awesome Print Demo
require 'awesome_print'
# false
test_data = {:a => 'Ruby in Rails String', :b => {:array => [1,2,3]}}
# {:a => 'Ruby in Rails String', :b => {:array => [1,2,3]}}
ap test_data
# {
# :a => "Ruby in Rails String",
@akshaymohite
akshaymohite / will_paginate_extra_params.js
Created April 29, 2017 15:49
Will Paginate with extra params in request
<div id='will_paginate_id'>
<%= will_paginate @users, :params => {:is_active: true} %>
</div>
@akshaymohite
akshaymohite / will_paginate_on_click.js
Created April 29, 2017 15:49
Will Paginate on click callback
$('#will_paginate_id').bind('click', function(event){
window.scrollTo(0,0);
// Some code to show loader on screen
$('#loading').html('<div class="ui active dimmer"><div class="ui large text loader">Loading</div></div>');
});