Skip to content

Instantly share code, notes, and snippets.

Abhinay Kumar abhinaykumar

Block or report user

Report or block abhinaykumar

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
@abhinaykumar
abhinaykumar / break.py
Created Sep 25, 2018 — forked from obfusk/break.py
python equivalent of ruby's binding.pry
View break.py
import code; code.interact(local=dict(globals(), **locals()))
View bulk remove git tags using ruby
# n, can be the number of times you want to execute this command.
# In my case tag were like below
# release-1.4.0
# release-1.4.1
# release-1.4.10
# release-1.4.11
# release-1.4.2
# release-1.4.3
# release-1.4.4
# release-1.4.5
@abhinaykumar
abhinaykumar / rails http status codes
Created Apr 27, 2018 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
View rails http status codes
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@abhinaykumar
abhinaykumar / total_price.rb
Created Sep 29, 2016
This program is the part of a coding challenge where we need to calculate the total price of a Model of a car based on their policy and base price.
View total_price.rb
# Calculate the Total Price of a Model of Car based on the policy(which will
# decide margin) and based price provided by User. Every policy has a condition
# to calculate the margin which will then gets added to base price to get the
# total price of the car.
class Models
require 'open-uri'
require 'nokogiri'
def self.calculate_total_price(pricing_policy, base_price)
case pricing_policy
View Steps To Fetch Google Analytics using Legato gem( Rails ).md
require 'oauth2'
require 'legato'

client = OAuth2::Client.new('client-ID', 'client-secret', {
  :authorize_url => 'https://accounts.google.com/o/oauth2/auth',
  :token_url => 'https://accounts.google.com/o/oauth2/token'
})

client.auth_code.authorize_url({
@abhinaykumar
abhinaykumar / add_comma_to_phone_numbers_string.rb
Last active Mar 12, 2016
challenge is to add ',' at the end of every number which is not pin-code. Pincodes are the number lesser or equal to 5.
View add_comma_to_phone_numbers_string.rb
# challenge is to add ',' at the end of every number which is not pin-code. Pincodes are the number lesser or equal to 5.
# Also, make sure they all are one space apart.
# ex: "123 23424324 34534 2342442234"
# function should return: "123 23424324, 34534 2342442234,"
#
a = "1234 23434242 232342442 345 2342341234"
a.scan(/[\w']+/) do |w|
if w.length > 5
b << "#{w},"
next
View Collection_Radio_Button.rb
<%= f.collection_radio_buttons(:role, User::ROLES, :to_s, lambda{|i| i.to_s.humanize}) do |b| %>
<% b.label do %>
<%= b.radio_button %><%= if b.value == 'vendor' then 'Professional' else b.text end %>
<% end %>
<% end %>
You can’t perform that action at this time.